Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <type 'exceptions.AttributeError'>
- 'dict' object has no attribute 'pk'
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /usr/local/noc/lib/app/extmodelapplication.py (Line: 40)
- Function: __init__
- 33 int_query_fields = [] # Query integer fields for exact match
- 34 pk_field_name = None # Set by constructor
- 35 clean_fields = {} # field name -> Parameter instance
- 36 custom_fields = {} # name -> handler, populated automatically
- 37
- 38 def __init__(self, *args, **kwargs):
- 39 super(ExtModelApplication, self).__init__(*args, **kwargs)
- 40 ==> self.pk_field_name = self.model._meta.pk.name
- 41 # Prepare field converters
- 42 self.clean_fields = self.clean_fields.copy() # name -> Parameter
- 43 self.fk_fields = {}
- 44 for f in self.model._meta.fields:
- 45 if f.name in self.clean_fields:
- 46 continue # Overriden behavior
- Variables:
- self = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d90>
- args = (<noc.lib.app.site.Site object at 0x806415e50>,)
- kwargs = {}
- ------------------------------------------------------------------------
- File: /usr/local/noc/lib/app/site.py (Line: 361)
- Function: register
- 354 And register them
- 355 """
- 356 # Register application
- 357 app_id = app_class.get_app_id()
- 358 if app_id in self.apps:
- 359 raise Exception("Application %s is already registered" % app_id)
- 360 # Initialize application
- 361 ==> app = app_class(self)
- 362 self.apps[app_id] = app
- 363 # Install module URL resolver
- 364 try:
- 365 mr = self.urlresolvers[app.module, None]
- 366 except KeyError:
- 367 mr = patterns("")
- Variables:
- self = <noc.lib.app.site.Site object at 0x806415e50>
- app_id = 'inv.macdb'
- app_class = <class 'noc.inv.apps.macdb.views.MACApplication'>
- ------------------------------------------------------------------------
- File: /usr/local/noc/lib/app/application.py (Line: 103)
- Function: __new__
- 96
- 97 def __new__(cls, name, bases, attrs):
- 98 global site
- 99 m = type.__new__(cls, name, bases, attrs)
- 100 for name in attrs:
- 101 m.add_to_class(name, attrs[name])
- 102 if "apps" in m.__module__:
- 103 ==> site.register(m)
- 104 return m
- 105
- 106
- 107 class Application(object):
- 108 """
- 109 Basic application class.
- Variables:
- cls = <class 'noc.lib.app.application.ApplicationBase'>
- bases = (<class 'noc.lib.app.extmodelapplication.ExtModelApplication'>,)
- m = <class 'noc.inv.apps.macdb.views.MACApplication'>
- attrs = {'__module__': 'noc.inv.apps.macdb.views', 'implied_permissions': {'read': ['vc:vcdomain:lookup', 'main:style:lookup']}, 'int_query_fields': ['vlan'], 'title': 'macdb', 'menu': 'Mac DB', 'query_fields': ['mac', 'interface', 'managed_object'], 'query_condition': 'icontains', 'model': <class 'noc.inv.models.macdb.MACDB'>, '__doc__': '\n MAC application\n ', 'field_row_class': <function field_row_class at 0x80830e578>}
- name = 'field_row_class'
- ------------------------------------------------------------------------
- File: /usr/local/noc/inv/apps/macdb/views.py (Line: 21)
- Function: <module>
- 14 from noc.inv.models import MACDB, MACLog, SubInterface, Q
- 15 from noc.sa.interfaces import DictParameter, ModelParameter, ListOfParameter,\
- 16 IntParameter, StringParameter
- 17 from noc.sa.caches import managedobjectselector_object_ids
- 18 from noc.vc.caches import vcinterfacescount, vcprefixes
- 19
- 20
- 21 ==> class MACApplication(ExtModelApplication):
- 22 """
- 23 MAC application
- 24 """
- 25 title = "macdb"
- 26 menu = "Mac DB"
- 27 model = MACDB
- Variables:
- defaultdict = None
- IntParameter = None
- MACDB = None
- ListOfParameter = None
- __builtins__ = {'bytearray': <type 'bytearray'>, 'IndexError': <type 'exceptions.IndexError'>, 'all': <built-in function all>, 'help': Type help() for interactive help, or help(object) for help about object., 'vars': <built-in function vars>, 'SyntaxError': <type 'exceptions.SyntaxError'>, 'unicode': <type 'unicode'>, 'UnicodeDecodeError': <type 'exceptions.UnicodeDecodeError'>, 'memoryview': <type 'memoryview'>, 'isinstance': <built-in function isinstance>, 'copyright': Copyright (c) 2001-2011 Python Software Foundation.
- All Rights Reserved.
- Copyright (c) 2000 BeOpen.com.
- All Rights Reserved.
- Copyright (c) 1995-2001 Corporation for National Research Initiatives.
- All Rights Reserved.
- Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
- All Rights Reserved., 'NameError': <type 'exceptions.NameError'>, 'BytesWarning': <type 'exceptions.BytesWarning'>, 'dict': <type 'dict'>, 'input': <built-in function input>, 'oct': <built-in function oct>, 'bin': <built-in function bin>, 'SystemExit': <type 'exceptions.SystemExit'>, 'StandardError': <type 'exceptions.StandardError'>, 'format': <built-in function format>, 'repr': <built-in function repr>, 'sorted': <built-in function sorted>, 'False': False, 'RuntimeWarning': <type 'exceptions.RuntimeWarning'>, 'list': <type 'list'>, 'iter': <built-in function iter>, 'reload': <built-in function reload>, 'Warning': <type 'exceptions.Warning'>, '__package__': None, 'round': <built-in function round>, 'dir': <built-in function dir>, 'cmp': <built-in function cmp>, 'set': <type 'set'>, 'bytes': <type 'str'>, 'reduce': <built-in function reduce>, 'intern': <built-in function intern>, 'issubclass': <built-in function issubclass>, 'Ellipsis': Ellipsis, 'EOFError': <type 'exceptions.EOFError'>, 'locals': <built-in function locals>, 'BufferError': <type 'exceptions.BufferError'>, 'slice': <type 'slice'>, 'FloatingPointError': <type 'exceptions.FloatingPointError'>, 'sum': <built-in function sum>, 'getattr': <built-in function getattr>, 'abs': <built-in function abs>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'print': <built-in function print>, 'True': True, 'FutureWarning': <type 'exceptions.FutureWarning'>, 'ImportWarning': <type 'exceptions.ImportWarning'>, 'None': None, 'hash': <built-in function hash>, 'ReferenceError': <type 'exceptions.ReferenceError'>, 'len': <built-in function len>, 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
- for supporting Python development. See www.python.org for more information., 'frozenset': <type 'frozenset'>, '__name__': '__builtin__', 'ord': <built-in function ord>, 'super': <type 'super'>, 'TypeError': <type 'exceptions.TypeError'>, 'license': Type license() to see the full license text, 'KeyboardInterrupt': <type 'exceptions.KeyboardInterrupt'>, 'UserWarning': <type 'exceptions.UserWarning'>, 'filter': <built-in function filter>, 'range': <built-in function range>, 'staticmethod': <type 'staticmethod'>, 'SystemError': <type 'exceptions.SystemError'>, 'BaseException': <type 'exceptions.BaseException'>, 'pow': <function _gmpy_pow at 0x8036ad848>, 'RuntimeError': <type 'exceptions.RuntimeError'>, 'float': <type 'float'>, 'MemoryError': <type 'exceptions.MemoryError'>, 'StopIteration': <type 'exceptions.StopIteration'>, 'globals': <built-in function globals>, 'divmod': <built-in function divmod>, 'enumerate': <type 'enumerate'>, 'apply': <built-in function apply>, 'LookupError': <type 'exceptions.LookupError'>, 'open': <built-in function open>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'basestring': <type 'basestring'>, 'UnicodeError': <type 'exceptions.UnicodeError'>, 'zip': <built-in function zip>, 'hex': <built-in function hex>, 'long': <type 'long'>, 'next': <built-in function next>, 'ImportError': <type 'exceptions.ImportError'>, 'chr': <built-in function chr>, 'xrange': <type 'xrange'>, 'type': <type 'type'>, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", 'Exception': <type 'exceptions.Exception'>, 'tuple': <type 'tuple'>, 'UnicodeTranslateError': <type 'exceptions.UnicodeTranslateError'>, 'reversed': <type 'reversed'>, 'UnicodeEncodeError': <type 'exceptions.UnicodeEncodeError'>, 'IOError': <type 'exceptions.IOError'>, 'hasattr': <built-in function hasattr>, 'delattr': <built-in function delattr>, 'setattr': <built-in function setattr>, 'raw_input': <built-in function raw_input>, 'SyntaxWarning': <type 'exceptions.SyntaxWarning'>, 'compile': <built-in function compile>, 'ArithmeticError': <type 'exceptions.ArithmeticError'>, 'str': <type 'str'>, 'property': <type 'property'>, 'GeneratorExit': <type 'exceptions.GeneratorExit'>, 'int': <type 'int'>, '__import__': <built-in function __import__>, 'KeyError': <type 'exceptions.KeyError'>, 'coerce': <built-in function coerce>, 'PendingDeprecationWarning': <type 'exceptions.PendingDeprecationWarning'>, 'file': <type 'file'>, 'EnvironmentError': <type 'exceptions.EnvironmentError'>, 'unichr': <built-in function unichr>, 'id': <built-in function id>, 'OSError': <type 'exceptions.OSError'>, 'DeprecationWarning': <type 'exceptions.DeprecationWarning'>, 'min': <built-in function min>, 'UnicodeWarning': <type 'exceptions.UnicodeWarning'>, 'execfile': <built-in function execfile>, 'any': <built-in function any>, 'complex': <type 'complex'>, 'bool': <type 'bool'>, 'ValueError': <type 'exceptions.ValueError'>, 'NotImplemented': NotImplemented, 'map': <built-in function map>, 'buffer': <type 'buffer'>, 'max': <built-in function max>, 'object': <type 'object'>, 'TabError': <type 'exceptions.TabError'>, 'callable': <built-in function callable>, 'ZeroDivisionError': <type 'exceptions.ZeroDivisionError'>, 'eval': <built-in function eval>, '__debug__': True, 'IndentationError': <type 'exceptions.IndentationError'>, 'AssertionError': <type 'exceptions.AssertionError'>, 'classmethod': <type 'classmethod'>, 'UnboundLocalError': <type 'exceptions.UnboundLocalError'>, 'NotImplementedError': <type 'exceptions.NotImplementedError'>, 'AttributeError': <type 'exceptions.AttributeError'>, 'OverflowError': <type 'exceptions.OverflowError'>}
- __file__ = None
- MACLog = None
- StringParameter = None
- managedobjectselector_object_ids = None
- __package__ = None
- Q = None
- DictParameter = None
- vcinterfacescount = None
- ModelParameter = None
- ExtModelApplication = None
- __name__ = None
- SubInterface = None
- vcprefixes = None
- __doc__ = None
- view = None
- ------------------------------------------------------------------------
- File: /usr/local/noc/lib/app/site.py (Line: 443)
- Function: autodiscover
- 436 # Initialize application
- 437 for f in glob.glob("%s/apps/*/views.py" % m):
- 438 d = os.path.split(f)[0]
- 439 # Skip application loading if denoted by DISABLED file
- 440 if os.path.isfile(os.path.join(d, "DISABLED")):
- 441 continue
- 442 __import__(".".join(["noc"] + f[:-3].split(os.path.sep)),
- 443 ==> {}, {}, "*")
- 444 # Try to install dynamic menus
- 445 menu = None
- 446 try:
- 447 menu = __import__(app + ".menu", {}, {}, "DYNAMIC_MENUS")
- 448 except ImportError:
- 449 continue
- Variables:
- a = 'noc.kb'
- d = 'inv/apps/macdb'
- f = 'inv/apps/macdb/views.py'
- menu = None
- app = 'noc.inv'
- m = 'inv'
- root = {'id': 'f0009c8c3f66558995669137bf30efbb6eefab3a', 'children': [{'access': <function <lambda> at 0x808445de8>, 'app': <noc.inv.apps.interface.views.InterfaceAppplication object at 0x808446c10>, 'id': '8730ff9cebba5a27cb40938bb592e67f20c075cb', 'iconCls': 'icon_application_form', 'title': u'Interfaces'}, {'id': 'bdf4c5809b20e1dcd6cadad7fe52e0864d49e1be', 'iconCls': 'icon_wrench_orange', 'children': [{'access': <function <lambda> at 0x8083aac80>, 'app': <noc.inv.apps.interfaceprofile.views.InterfaceProfileApplication object at 0x808446ed0>, 'id': '048cff360e2ac0fdf6b1ab42168b6f36b1029268', 'iconCls': 'icon_application_view_list', 'title': u'Interface Profiles'}, {'access': <function <lambda> at 0x8083aa668>, 'app': <noc.inv.apps.model.views.ModelApplication object at 0x80844a410>, 'id': '921745dc855418e99c96206777cecdb5f38b74ae', 'iconCls': 'icon_application', 'title': 'Models'}, {'access': <function <lambda> at 0x8083aa1b8>, 'app': <noc.inv.apps.socket.views.SocketApplication object at 0x80844a890>, 'id': '7c934dd2d4e4d2e279b0665fa14ec95a040b6fc2', 'iconCls': 'icon_application', 'title': 'Sockets'}, {'access': <function <lambda> at 0x8083a89b0>, 'app': <noc.inv.apps.vendor.views.VendorApplication object at 0x80844a910>, 'id': 'd8814951d698e2eb09b45432334e1e5a978c6d82', 'iconCls': 'icon_application_view_list', 'title': u'Vendors'}], 'title': u'Setup'}, {'access': <function <lambda> at 0x80830eaa0>, 'app': <noc.inv.apps.macs.views.InterfaceAppplication object at 0x8084500d0>, 'id': '9a2561256714f9592807690d8d421d7b58910d94', 'iconCls': 'icon_application_form', 'title': u'MACs'}], 'title': 'Inventory'}
- self = <noc.lib.app.site.Site object at 0x806415e50>
- ------------------------------------------------------------------------
- File: /usr/local/noc/main/web.py (Line: 139)
- Function: children_loop
- 132 self.server._pending_sockets = []
- 133 self.server.add_sockets(sockets)
- 134 # Connect to mongodb
- 135 import noc.lib.nosql
- 136 # Initialize site
- 137 logging.info("Registering web applications")
- 138 from noc.lib.app import site
- 139 ==> site.autodiscover()
- 140 # Run children's I/O loop
- 141 logging.info("Starting to serve requests")
- 142 tornado.ioloop.IOLoop.instance().start()
- 143
- 144 def at_exit(self):
- 145 if self.t_children:
- Variables:
- self = <noc.main.web.Web object at 0x8011baf50>
- sockets = [<socket._socketobject object at 0x805254280>]
- site = <noc.lib.app.site.Site object at 0x806415e50>
- noc = <module 'noc' from '/usr/local/noc/__init__.pyc'>
- ------------------------------------------------------------------------
- File: /usr/local/noc/main/web.py (Line: 110)
- Function: run
- 103 nc = cpu_count()
- 104 self.t_children = set()
- 105 while True:
- 106 # Run children
- 107 while len(self.t_children) < nc:
- 108 pid = os.fork()
- 109 if pid == 0:
- 110 ==> self.children_loop()
- 111 elif pid < 0:
- 112 logging.error("Unable to fork child")
- 113 else:
- 114 logging.info("Running child %d" % pid)
- 115 self.t_children.add(pid)
- 116 # Wait for status
- Variables:
- status = 0
- self = <noc.main.web.Web object at 0x8011baf50>
- nc = 2
- pid = 0
- noc_wsgi = <tornado.wsgi.WSGIContainer object at 0x80424bfd0>
- application = <tornado.web.Application object at 0x8042580d0>
- address = '127.0.0.1'
- port = 8000
- listen = '127.0.0.1:8000'
- ------------------------------------------------------------------------
- File: /usr/local/noc/lib/daemon.py (Line: 364)
- Function: guarded_run
- 357
- 358 def guarded_run(self):
- 359 """
- 360 Run daemon and catch common exceptions
- 361 :return:
- 362 """
- 363 try:
- 364 ==> self.run()
- 365 except KeyboardInterrupt:
- 366 pass
- 367 except MemoryError:
- 368 logging.error("Out of memory. Exiting.")
- 369 except SystemExit:
- 370 logging.info("Exiting")
- Variables:
- self = <noc.main.web.Web object at 0x8011baf50>
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement