Advertisement
Guest User

Untitled

a guest
Oct 17th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.70 KB | None | 0 0
  1. <type 'exceptions.AttributeError'>
  2. 'dict' object has no attribute 'pk'
  3. START OF TRACEBACK
  4. ------------------------------------------------------------------------
  5. File: /usr/local/noc/lib/app/extmodelapplication.py (Line: 40)
  6. Function: __init__
  7. 33 int_query_fields = [] # Query integer fields for exact match
  8. 34 pk_field_name = None # Set by constructor
  9. 35 clean_fields = {} # field name -> Parameter instance
  10. 36 custom_fields = {} # name -> handler, populated automatically
  11. 37
  12. 38 def __init__(self, *args, **kwargs):
  13. 39 super(ExtModelApplication, self).__init__(*args, **kwargs)
  14. 40 ==> self.pk_field_name = self.model._meta.pk.name
  15. 41 # Prepare field converters
  16. 42 self.clean_fields = self.clean_fields.copy() # name -> Parameter
  17. 43 self.fk_fields = {}
  18. 44 for f in self.model._meta.fields:
  19. 45 if f.name in self.clean_fields:
  20. 46 continue # Overriden behavior
  21. Variables:
  22. self = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d90>
  23. args = (<noc.lib.app.site.Site object at 0x806415e50>,)
  24. kwargs = {}
  25. ------------------------------------------------------------------------
  26. File: /usr/local/noc/lib/app/site.py (Line: 361)
  27. Function: register
  28. 354 And register them
  29. 355 """
  30. 356 # Register application
  31. 357 app_id = app_class.get_app_id()
  32. 358 if app_id in self.apps:
  33. 359 raise Exception("Application %s is already registered" % app_id)
  34. 360 # Initialize application
  35. 361 ==> app = app_class(self)
  36. 362 self.apps[app_id] = app
  37. 363 # Install module URL resolver
  38. 364 try:
  39. 365 mr = self.urlresolvers[app.module, None]
  40. 366 except KeyError:
  41. 367 mr = patterns("")
  42. Variables:
  43. self = <noc.lib.app.site.Site object at 0x806415e50>
  44. app_id = 'inv.macdb'
  45. app_class = <class 'noc.inv.apps.macdb.views.MACApplication'>
  46. ------------------------------------------------------------------------
  47. File: /usr/local/noc/lib/app/application.py (Line: 103)
  48. Function: __new__
  49. 96
  50. 97 def __new__(cls, name, bases, attrs):
  51. 98 global site
  52. 99 m = type.__new__(cls, name, bases, attrs)
  53. 100 for name in attrs:
  54. 101 m.add_to_class(name, attrs[name])
  55. 102 if "apps" in m.__module__:
  56. 103 ==> site.register(m)
  57. 104 return m
  58. 105
  59. 106
  60. 107 class Application(object):
  61. 108 """
  62. 109 Basic application class.
  63. Variables:
  64. cls = <class 'noc.lib.app.application.ApplicationBase'>
  65. bases = (<class 'noc.lib.app.extmodelapplication.ExtModelApplication'>,)
  66. m = <class 'noc.inv.apps.macdb.views.MACApplication'>
  67. 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>}
  68. name = 'field_row_class'
  69. ------------------------------------------------------------------------
  70. File: /usr/local/noc/inv/apps/macdb/views.py (Line: 21)
  71. Function: <module>
  72. 14 from noc.inv.models import MACDB, MACLog, SubInterface, Q
  73. 15 from noc.sa.interfaces import DictParameter, ModelParameter, ListOfParameter,\
  74. 16 IntParameter, StringParameter
  75. 17 from noc.sa.caches import managedobjectselector_object_ids
  76. 18 from noc.vc.caches import vcinterfacescount, vcprefixes
  77. 19
  78. 20
  79. 21 ==> class MACApplication(ExtModelApplication):
  80. 22 """
  81. 23 MAC application
  82. 24 """
  83. 25 title = "macdb"
  84. 26 menu = "Mac DB"
  85. 27 model = MACDB
  86. Variables:
  87. defaultdict = None
  88. IntParameter = None
  89. MACDB = None
  90. ListOfParameter = None
  91. __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.
  92. All Rights Reserved.
  93.  
  94. Copyright (c) 2000 BeOpen.com.
  95. All Rights Reserved.
  96.  
  97. Copyright (c) 1995-2001 Corporation for National Research Initiatives.
  98. All Rights Reserved.
  99.  
  100. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
  101. 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
  102. 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'>}
  103. __file__ = None
  104. MACLog = None
  105. StringParameter = None
  106. managedobjectselector_object_ids = None
  107. __package__ = None
  108. Q = None
  109. DictParameter = None
  110. vcinterfacescount = None
  111. ModelParameter = None
  112. ExtModelApplication = None
  113. __name__ = None
  114. SubInterface = None
  115. vcprefixes = None
  116. __doc__ = None
  117. view = None
  118. ------------------------------------------------------------------------
  119. File: /usr/local/noc/lib/app/site.py (Line: 443)
  120. Function: autodiscover
  121. 436 # Initialize application
  122. 437 for f in glob.glob("%s/apps/*/views.py" % m):
  123. 438 d = os.path.split(f)[0]
  124. 439 # Skip application loading if denoted by DISABLED file
  125. 440 if os.path.isfile(os.path.join(d, "DISABLED")):
  126. 441 continue
  127. 442 __import__(".".join(["noc"] + f[:-3].split(os.path.sep)),
  128. 443 ==> {}, {}, "*")
  129. 444 # Try to install dynamic menus
  130. 445 menu = None
  131. 446 try:
  132. 447 menu = __import__(app + ".menu", {}, {}, "DYNAMIC_MENUS")
  133. 448 except ImportError:
  134. 449 continue
  135. Variables:
  136. a = 'noc.kb'
  137. d = 'inv/apps/macdb'
  138. f = 'inv/apps/macdb/views.py'
  139. menu = None
  140. app = 'noc.inv'
  141. m = 'inv'
  142. 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'}
  143. self = <noc.lib.app.site.Site object at 0x806415e50>
  144. ------------------------------------------------------------------------
  145. File: /usr/local/noc/main/web.py (Line: 139)
  146. Function: children_loop
  147. 132 self.server._pending_sockets = []
  148. 133 self.server.add_sockets(sockets)
  149. 134 # Connect to mongodb
  150. 135 import noc.lib.nosql
  151. 136 # Initialize site
  152. 137 logging.info("Registering web applications")
  153. 138 from noc.lib.app import site
  154. 139 ==> site.autodiscover()
  155. 140 # Run children's I/O loop
  156. 141 logging.info("Starting to serve requests")
  157. 142 tornado.ioloop.IOLoop.instance().start()
  158. 143
  159. 144 def at_exit(self):
  160. 145 if self.t_children:
  161. Variables:
  162. self = <noc.main.web.Web object at 0x8011baf50>
  163. sockets = [<socket._socketobject object at 0x805254280>]
  164. site = <noc.lib.app.site.Site object at 0x806415e50>
  165. noc = <module 'noc' from '/usr/local/noc/__init__.pyc'>
  166. ------------------------------------------------------------------------
  167. File: /usr/local/noc/main/web.py (Line: 110)
  168. Function: run
  169. 103 nc = cpu_count()
  170. 104 self.t_children = set()
  171. 105 while True:
  172. 106 # Run children
  173. 107 while len(self.t_children) < nc:
  174. 108 pid = os.fork()
  175. 109 if pid == 0:
  176. 110 ==> self.children_loop()
  177. 111 elif pid < 0:
  178. 112 logging.error("Unable to fork child")
  179. 113 else:
  180. 114 logging.info("Running child %d" % pid)
  181. 115 self.t_children.add(pid)
  182. 116 # Wait for status
  183. Variables:
  184. status = 0
  185. self = <noc.main.web.Web object at 0x8011baf50>
  186. nc = 2
  187. pid = 0
  188. noc_wsgi = <tornado.wsgi.WSGIContainer object at 0x80424bfd0>
  189. application = <tornado.web.Application object at 0x8042580d0>
  190. address = '127.0.0.1'
  191. port = 8000
  192. listen = '127.0.0.1:8000'
  193. ------------------------------------------------------------------------
  194. File: /usr/local/noc/lib/daemon.py (Line: 364)
  195. Function: guarded_run
  196. 357
  197. 358 def guarded_run(self):
  198. 359 """
  199. 360 Run daemon and catch common exceptions
  200. 361 :return:
  201. 362 """
  202. 363 try:
  203. 364 ==> self.run()
  204. 365 except KeyboardInterrupt:
  205. 366 pass
  206. 367 except MemoryError:
  207. 368 logging.error("Out of memory. Exiting.")
  208. 369 except SystemExit:
  209. 370 logging.info("Exiting")
  210. Variables:
  211. self = <noc.main.web.Web object at 0x8011baf50>
  212. ------------------------------------------------------------------------
  213. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement