SpriteLink / NIPAP

Neat IP Address Planner - NIPAP is the best open source IPAM in the known universe, challenging classical IP address management (IPAM) systems in many areas.
https://spritelink.github.io/NIPAP/
MIT License
536 stars 132 forks source link

nipap-www - 'HTTPFound' object has no attribute 'exception' #624

Open cholin opened 9 years ago

cholin commented 9 years ago

I installed NIPAP recently (using current master) and wanted to try nipap-www. Unfortunately after installing nipap-www (python setup.py install) and starting nipap-www through paster I always got an AttributeError when I tried to open the web interface in my browser. Error log looks like the following:

$ paster serve nipap-www.ini
Starting server in PID 19129.
serving on 0.0.0.0:5000 view at http://127.0.0.1:5000
Error - <type 'exceptions.AttributeError'>: 'HTTPFound' object has no attribute 'exception'
URL: http://127.0.0.1:5000/
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py', line 162 in __call__
  app_iter = self.application(environ, sr_checker)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Beaker-1.6.4-py2.7.egg/beaker/middleware.py', line 155 in __call__
  return self.wrap_app(environ, session_start_response)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Routes-2.0-py2.7.egg/routes/middleware.py', line 131 in __call__
  response = self.app(environ, start_response)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/wsgiapp.py', line 103 in __call__
  response = self.dispatch(controller, environ, start_response)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/wsgiapp.py', line 313 in dispatch
  return controller(environ, start_response)
File '/home/cholin/projects/NIPAP/nipap-www/nipapwww/lib/base.py', line 54 in __call__
  return WSGIController.__call__(self, environ, start_response)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/controllers/core.py', line 210 in __call__
  response = self._inspect_call(self.__before__)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/controllers/core.py', line 107 in _inspect_call
  result = self._perform_call(func, args)
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/controllers/core.py', line 57 in _perform_call
  return func(**args)
File '/home/cholin/projects/NIPAP/nipap-www/nipapwww/lib/base.py', line 45 in __before__
  redirect(url(controller='auth', action='login'))
File '/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/Pylons-1.0.1-py2.7.egg/pylons/controllers/util.py', line 224 in redirect
  raise exc(location=url).exception
AttributeError: 'HTTPFound' object has no attribute 'exception'

CGI Variables
-------------
  CONTENT_LENGTH: '0'
  HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
  HTTP_ACCEPT_ENCODING: 'gzip,deflate,sdch'
  HTTP_ACCEPT_LANGUAGE: 'de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4'
  HTTP_CACHE_CONTROL: 'max-age=0'
  HTTP_CONNECTION: 'keep-alive'
  HTTP_DNT: '1'
  HTTP_HOST: '127.0.0.1:5000'
  HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36'
  PATH_INFO: '/'
  REMOTE_ADDR: '127.0.0.1'
  REQUEST_METHOD: 'GET'
  SERVER_NAME: '0.0.0.0'
  SERVER_PORT: '5000'
  SERVER_PROTOCOL: 'HTTP/1.1'

WSGI Variables
--------------
  application: <beaker.middleware.SessionMiddleware object at 0x7f4d5b3a4d90>
  beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x7f4d5b3a4d90>>
  beaker.session: {'path_before_login': u'/', '_accessed_time': 1411602696.970841, '_creation_time': 1411602696.970841}
  paste.httpserver.thread_pool: <paste.httpserver.ThreadPool object at 0x7f4d5a372a90>
  paste.registry: <paste.registry.Registry object at 0x7f4d5a386a50>
  paste.throw_errors: True
  pylons.controller: <nipapwww.controllers.prefix.PrefixController object at 0x7f4d5a386f10>
  pylons.environ_config: {'session': 'beaker.session', 'cache': 'beaker.cache'}
  pylons.log_debug: False
  pylons.pylons: <pylons.util.PylonsContext object at 0x7f4d5a386e50>
  pylons.routes_dict: {'action': u'index', 'controller': u'prefix'}
  routes.route: <routes.route.Route object at 0x7f4d5a35c850>
  routes.url: <routes.util.URLGenerator object at 0x7f4d5a386d50>
  wsgi process: 'Multithreaded'
  wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x7f4d5a386d50>, {'action': u'index', 'controller': u'prefix'})
------------------------------------------------------------

            <p>Additionally an error occurred while sending the &lt;weberror.reporter.EmailReporter object at 0x7f4d58111bd0&gt; report:

            <pre>Traceback (most recent call last):
  File "/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py", line 450, in send_report
    rep.report(exc_data)
  File "/home/cholin/projects/NIPAP/env/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/reporter.py", line 45, in report
    server = smtplib.SMTP(self.smtp_server)
  File "/usr/lib64/python2.7/smtplib.py", line 251, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib64/python2.7/smtplib.py", line 311, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib64/python2.7/smtplib.py", line 286, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
    raise err
error: [Errno 111] Connection refused
</pre>

If you google for AttributeError: 'HTTPFound' object has no attribute 'exception' you will find https://stackoverflow.com/questions/24103865/pylons-redirect-gives-attributeerror-httpfound-object-has-no-attribute-exce. Seems by default python setup.py install in nipap-www installs the wrong version for WebOb (see https://github.com/SpriteLink/NIPAP/blob/master/nipap-www/setup.py#L12) or nipap-www is using deprecated/removed functionality of WebOb. To fix this I had to install WebOb 1.3.1 manually on my ArchLinux system:

pip install WebOb==1.3.1

I think this should get fixed.

plajjan commented 9 years ago

So, you essentially want a requirements.txt file for nipap-www pinning the required modules and avoiding this situation then...

Pavand074 commented 4 years ago

i am not able to add a prefix within a prefix using python module pynipap,please help me out with this