Advertisement
Guest User

Untitled

a guest
Oct 17th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.62 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2012-10-17 17:02:21.137814)
  2. Working directory: /usr/local/noc
  3. <type 'exceptions.TypeError'>
  4. ObjectId('503ccdcb5c8b8212bf000e4a') is not JSON serializable
  5. START OF TRACEBACK
  6. ------------------------------------------------------------------------
  7. File: /usr/local/lib/python2.7/json/encoder.py (Line: 178)
  8. Function: default
  9. 171 except TypeError:
  10. 172 pass
  11. 173 else:
  12. 174 return list(iterable)
  13. 175 return JSONEncoder.default(self, o)
  14. 176
  15. 177 """
  16. 178 ==> raise TypeError(repr(o) + " is not JSON serializable")
  17. 179
  18. 180 def encode(self, o):
  19. 181 """Return a JSON string representation of a Python data structure.
  20. 182
  21. 183 >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
  22. 184 '{"foo": ["bar", "baz"]}'
  23. Variables:
  24. self = <json.encoder.JSONEncoder object at 0x801bc3e10>
  25. o = ObjectId('503ccdcb5c8b8212bf000e4a')
  26. ------------------------------------------------------------------------
  27. File: /usr/local/lib/python2.7/json/encoder.py (Line: 264)
  28. Function: iterencode
  29. 257 self.key_separator, self.item_separator, self.sort_keys,
  30. 258 self.skipkeys, self.allow_nan)
  31. 259 else:
  32. 260 _iterencode = _make_iterencode(
  33. 261 markers, self.default, _encoder, self.indent, floatstr,
  34. 262 self.key_separator, self.item_separator, self.sort_keys,
  35. 263 self.skipkeys, _one_shot)
  36. 264 ==> return _iterencode(o, 0)
  37. 265
  38. 266 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
  39. 267 _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
  40. 268 ## HACK: hand-optimized bytecode; turn globals into locals
  41. 269 ValueError=ValueError,
  42. 270 basestring=basestring,
  43. Variables:
  44. _encoder = <built-in function encode_basestring_ascii>
  45. floatstr = <function floatstr at 0x808f48c80>
  46. self = <json.encoder.JSONEncoder object at 0x801bc3e10>
  47. o = [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, 'managed_object': 263, 'last_changed': u'2012-10-17 02:56:23.460000', 'mac': u'00:1D:0F:CE:5F:0D', 'fav_status': False, 'interface': ObjectId('503ccdcb5c8b8212bf000e4a'), 'id': u'507db5775c8b823777000000'}, {'managed_object__label': u'e38-cc-1-4-6506', 'vlan': 241, 'managed_object': 116, 'last_changed': u'2012-10-17 00:12:46.416000', 'mac': u'00:23:F8:5B:C7:35', 'fav_status': False, 'interface': ObjectId('5017cafa5c8b820f9a0001cd'), 'id': u'507db5775c8b823777000001'}]
  48. _one_shot = True
  49. markers = {34509283128: [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, 'managed_object': 263, 'last_changed': u'2012-10-17 02:56:23.460000', 'mac': u'00:1D:0F:CE:5F:0D', 'fav_status': False, 'interface': ObjectId('503ccdcb5c8b8212bf000e4a'), 'id': u'507db5775c8b823777000000'}, {'managed_object__label': u'e38-cc-1-4-6506', 'vlan': 241, 'managed_object': 116, 'last_changed': u'2012-10-17 00:12:46.416000', 'mac': u'00:23:F8:5B:C7:35', 'fav_status': False, 'interface': ObjectId('5017cafa5c8b820f9a0001cd'), 'id': u'507db5775c8b823777000001'}]
  50. _iterencode = <_json.Encoder object at 0x808f48de8>
  51. ------------------------------------------------------------------------
  52. File: /usr/local/lib/python2.7/json/encoder.py (Line: 201)
  53. Function: encode
  54. 194 if self.ensure_ascii:
  55. 195 return encode_basestring_ascii(o)
  56. 196 else:
  57. 197 return encode_basestring(o)
  58. 198 # This doesn't pass the iterator directly to ''.join() because the
  59. 199 # exceptions aren't as detailed. The list call should be roughly
  60. 200 # equivalent to the PySequence_Fast that ''.join() would do.
  61. 201 ==> chunks = self.iterencode(o, _one_shot=True)
  62. 202 if not isinstance(chunks, (list, tuple)):
  63. 203 chunks = list(chunks)
  64. 204 return ''.join(chunks)
  65. 205
  66. 206 def iterencode(self, o, _one_shot=False):
  67. 207 """Encode the given object and yield each string
  68. Variables:
  69. self = <json.encoder.JSONEncoder object at 0x801bc3e10>
  70. o = [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, ----etc
  71. ------------------------------------------------------------------------
  72. File: /usr/local/lib/python2.7/json/__init__.py (Line: 231)
  73. Function: dumps
  74. 224
  75. 225 """
  76. 226 # cached encoder
  77. 227 if (not skipkeys and ensure_ascii and
  78. 228 check_circular and allow_nan and
  79. 229 cls is None and indent is None and separators is None and
  80. 230 encoding == 'utf-8' and default is None and not kw):
  81. 231 ==> return _default_encoder.encode(obj)
  82. 232 if cls is None:
  83. 233 cls = JSONEncoder
  84. 234 return cls(
  85. 235 skipkeys=skipkeys, ensure_ascii=ensure_ascii,
  86. 236 check_circular=check_circular, allow_nan=allow_nan, indent=indent,
  87. 237 separators=separators, encoding=encoding, default=default,
  88. Variables:
  89. indent = None
  90. encoding = 'utf-8'
  91. default = None
  92. separators = None
  93. skipkeys = False
  94. kw = {}
  95. check_circular = True
  96. allow_nan = True
  97. obj = [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, 'managed_object': 263 ---etc
  98.  
  99.  
  100. ensure_ascii = True
  101. cls = None
  102. ------------------------------------------------------------------------
  103. File: /usr/local/noc/lib/app/extapplication.py (Line: 66)
  104. Function: response
  105. 59 return HasPerm("%s:%s:launch" % (m, a))
  106. 60
  107. 61 def deserialize(self, data):
  108. 62 return json_decode(data)
  109. 63
  110. 64 def response(self, content="", status=200):
  111. 65 if not isinstance(content, basestring):
  112. 66 ==> return HttpResponse(json_encode(content),
  113. 67 mimetype="text/json; charset=utf-8",
  114. 68 status=status)
  115. 69 else:
  116. 70 return HttpResponse(content,
  117. 71 mimetype="text/plain; charset=utf-8",
  118. 72 status=status)
  119. Variables:
  120. status = 200
  121. content = [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, 'managed_object': 263, 'last_changed': u'2012-10-17 02:56:23.460000', 'mac': u'00:1D:0F:CE:5F:0D', 'fav_status': False, 'interface': ObjectId('503ccdcb5c8b8212bf000e4a'), 'id': u'507db5775c8b823777000000'}, ---etc
  122.  
  123. self = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>
  124. ------------------------------------------------------------------------
  125. File: /usr/local/noc/lib/app/extapplication.py (Line: 158)
  126. Function: list_data
  127. 151 r[self.fav_status] = r["id"] in fav_items
  128. 152 if format == "ext":
  129. 153 out = {
  130. 154 "total": total,
  131. 155 "success": True,
  132. 156 "data": out
  133. 157 }
  134. 158 ==> return self.response(out, status=self.OK)
  135. 159
  136. 160 @view(url="^(?P<path>(?:js|css|img)/[0-9a-zA-Z_/]+\.(?:js|css|png))$",
  137. 161 url_name="static", access=True)
  138. 162 def view_static(self, request, path):
  139. 163 """
  140. 164 Static file server
  141. Variables:
  142. fs = None
  143. format = None
  144. ordering = []
  145. self = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>
  146. request = <WSGIRequest
  147. path:/inv/macdb/,
  148. GET:<QueryDict: {}>,
  149. POST:<QueryDict: {}>,
  150. COOKIES:{'csrftoken': 'w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  151. 'sessionid': 'c3b60fa600f1360a07443dbedb4357da'},
  152. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  153. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  154. 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
  155. 'HTTP_CONNECTION': 'close',
  156. 'HTTP_COOKIE': 'sessionid=c3b60fa600f1360a07443dbedb4357da; csrftoken=w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  157. 'HTTP_HOST': '127.0.0.1:8000',
  158. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1',
  159. 'HTTP_X_CLICKONCESUPPORT': '( .NET CLR 3.5.30729; .NET4.0E)',
  160. 'PATH_INFO': u'/inv/macdb/',
  161. 'QUERY_STRING': '',
  162. 'REMOTE_ADDR': '127.0.0.1',
  163. 'REQUEST_METHOD': 'GET',
  164. 'SCRIPT_NAME': u'',
  165. 'SERVER_NAME': '127.0.0.1',
  166. 'SERVER_PORT': '8000',
  167. 'SERVER_PROTOCOL': 'HTTP/1.0',
  168. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x804235f60>,
  169. 'wsgi.input': <_io.BytesIO object at 0x808e39d10>,
  170. 'wsgi.multiprocess': True,
  171. 'wsgi.multithread': False,
  172. 'wsgi.run_once': False,
  173. 'wsgi.url_scheme': 'http',
  174. 'wsgi.version': (1, 0)}>
  175. o = <MACDB: E0:CB:4E:48:E7:A3>
  176. q = {}
  177. start = None
  178. only = None
  179. r = {'managed_object__label': u'bolsheoxt-6-1-es3528.line-r.ru', 'vlan': 91, 'managed_object': 114, 'last_changed': u'2012-10-17 16:49:37.989000', 'mac': u'E0:CB:4E:48:E7:A3', 'fav_status': False, 'interface': ObjectId('5017ce3c5c8b820f9a001022'), 'id': u'507ea9615c8b824826000078'}
  180. limit = None
  181. formatter = <bound method MACApplication.instance_to_dict of <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>>
  182. query = None
  183. out = [{'managed_object__label': u'Vsev.Ujnyi.Dobrovol-20-2-es3526-2-1.line-r.ru', 'vlan': 1, 'managed_object': 263, 'last_changed': u'2012-10-17 02:56:23.460000', 'mac': u'00:1D:0F:CE:5F:0D', 'fav_status': False, 'interface': ObjectId('503ccdcb5c8b8212bf000e4a'), 'id': u'507db5775c8b823777000000'}, {'managed_object__label': ---etc
  184.  
  185. data = [<MACDB: 00:1D:0F:CE:5F:0D>, <MACDB: 00:23:F8:5B:C7:35>, <MACDB: 54:04:A6:BC:03:AC>, <MACDB: B8:A3:86:21:9B:81>, <MACDB: 00:21:CC:70:5D:BD>, <MACDB: 28:10:7B:CF:0D:77>, <MACDB: 00:13:77:3E:A9:1F>, <MACDB: 00:24:54:DF:3A:82>, ---etc
  186. fav_items = set([])
  187. ------------------------------------------------------------------------
  188. File: /usr/local/noc/lib/app/extdocapplication.py (Line: 145)
  189. Function: api_list
  190. 138 return {
  191. 139 "id": str(o.id),
  192. 140 "label": unicode(o)
  193. 141 }
  194. 142
  195. 143 @view(method=["GET"], url="^$", access="read", api=True)
  196. 144 def api_list(self, request):
  197. 145 ==> return self.list_data(request, self.instance_to_dict)
  198. 146
  199. 147 @view(method=["GET"], url=r"^lookup/$", access="lookup", api=True)
  200. 148 def api_lookup(self, request):
  201. 149 return self.list_data(request, self.instance_to_lookup)
  202. 150
  203. 151 @view(method=["POST"], url="^$", access="create", api=True)
  204. Variables:
  205. self = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>
  206. request = <WSGIRequest
  207. path:/inv/macdb/,
  208. GET:<QueryDict: {}>,
  209. POST:<QueryDict: {}>,
  210. COOKIES:{'csrftoken': 'w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  211. 'sessionid': 'c3b60fa600f1360a07443dbedb4357da'},
  212. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  213. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  214. 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
  215. 'HTTP_CONNECTION': 'close',
  216. 'HTTP_COOKIE': 'sessionid=c3b60fa600f1360a07443dbedb4357da; csrftoken=w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  217. 'HTTP_HOST': '127.0.0.1:8000',
  218. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1',
  219. 'HTTP_X_CLICKONCESUPPORT': '( .NET CLR 3.5.30729; .NET4.0E)',
  220. 'PATH_INFO': u'/inv/macdb/',
  221. 'QUERY_STRING': '',
  222. 'REMOTE_ADDR': '127.0.0.1',
  223. 'REQUEST_METHOD': 'GET',
  224. 'SCRIPT_NAME': u'',
  225. 'SERVER_NAME': '127.0.0.1',
  226. 'SERVER_PORT': '8000',
  227. 'SERVER_PROTOCOL': 'HTTP/1.0',
  228. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x804235f60>,
  229. 'wsgi.input': <_io.BytesIO object at 0x808e39d10>,
  230. 'wsgi.multiprocess': True,
  231. 'wsgi.multithread': False,
  232. 'wsgi.run_once': False,
  233. 'wsgi.url_scheme': 'http',
  234. 'wsgi.version': (1, 0)}>
  235. ------------------------------------------------------------------------
  236. File: /usr/local/noc/lib/app/site.py (Line: 231)
  237. Function: inner
  238. 224 for k, v in request.POST.lists())
  239. 225 elif request.method == "GET":
  240. 226 a = dict((k, v[0] if len(v) == 1 else v)
  241. 227 for k, v in request.GET.lists())
  242. 228 logging.debug("API %s %s %s" % (request.method,
  243. 229 request.path, a))
  244. 230 # Call handler
  245. 231 ==> r = v(request, *args, **kwargs)
  246. 232 # Dump SQL statements
  247. 233 if self.log_sql_statements:
  248. 234 from django.db import connections
  249. 235 tsc = 0
  250. 236 sc = defaultdict(int)
  251. 237 for conn in connections.all():
  252. Variables:
  253. args = ()
  254. view_map = {'POST': <bound method MACApplication.api_create of <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>>, 'GET': <bound method MACApplication.api_list of <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>>}
  255. Form = <class 'django.forms.forms.Form'>
  256. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  257. self = <noc.lib.app.site.Site object at 0x806415e50>
  258. v = <bound method MACApplication.api_list of <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>>
  259. request = <WSGIRequest
  260. path:/inv/macdb/,
  261. GET:<QueryDict: {}>,
  262. POST:<QueryDict: {}>,
  263. COOKIES:{'csrftoken': 'w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  264. 'sessionid': 'c3b60fa600f1360a07443dbedb4357da'},
  265. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  266. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  267. 'HTTP_ACCEPT_LANGUAGE': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
  268. 'HTTP_CONNECTION': 'close',
  269. 'HTTP_COOKIE': 'sessionid=c3b60fa600f1360a07443dbedb4357da; csrftoken=w026pMQKaZ7OrQFlY3UDcfB6P8ZcUgOu',
  270. 'HTTP_HOST': '127.0.0.1:8000',
  271. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20100101 Firefox/15.0.1',
  272. 'HTTP_X_CLICKONCESUPPORT': '( .NET CLR 3.5.30729; .NET4.0E)',
  273. 'PATH_INFO': u'/inv/macdb/',
  274. 'QUERY_STRING': '',
  275. 'REMOTE_ADDR': '127.0.0.1',
  276. 'REQUEST_METHOD': 'GET',
  277. 'SCRIPT_NAME': u'',
  278. 'SERVER_NAME': '127.0.0.1',
  279. 'SERVER_PORT': '8000',
  280. 'SERVER_PROTOCOL': 'HTTP/1.0',
  281. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x804235f60>,
  282. 'wsgi.input': <_io.BytesIO object at 0x808e39d10>,
  283. 'wsgi.multiprocess': True,
  284. 'wsgi.multithread': False,
  285. 'wsgi.run_once': False,
  286. 'wsgi.url_scheme': 'http',
  287. 'wsgi.version': (1, 0)}>
  288. to_log_api_call = False
  289. InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
  290. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  291. kwargs = {}
  292. app = <noc.inv.apps.macdb.views.MACApplication object at 0x808450d50>
  293. ------------------------------------------------------------------------
  294. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement