Advertisement
Guest User

Untitled

a guest
Aug 13th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.92 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2013-08-13 15:18:05.181359)
  2. Working directory: /opt/noc
  3. <class 'mongoengine.queryset.InvalidQueryError'>
  4. Cannot resolve field "collapse"
  5. START OF TRACEBACK
  6. ------------------------------------------------------------------------
  7. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 639)
  8. Function: _lookup_field
  9. 632 if field_name in document._fields:
  10. 633 field = document._fields[field_name]
  11. 634 elif document._dynamic:
  12. 635 from fields import DynamicField
  13. 636 field = DynamicField(db_field=field_name)
  14. 637 else:
  15. 638 raise InvalidQueryError('Cannot resolve field "%s"'
  16. 639 ==> % field_name)
  17. 640 else:
  18. 641 from mongoengine.fields import ReferenceField, GenericReferenceField
  19. 642 if isinstance(field, (ReferenceField, GenericReferenceField)):
  20. 643 raise InvalidQueryError('Cannot perform join in mongoDB: %s' % '__'.join(parts))
  21. 644 if hasattr(getattr(field, 'field', None), 'lookup_member'):
  22. 645 new_field = field.field.lookup_member(field_name)
  23. Variables:
  24. fields = []
  25. field = None
  26. parts = ['collapse']
  27. document = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  28. field_name = 'collapse'
  29. cls = <class 'mongoengine.queryset.QuerySet'>
  30. ------------------------------------------------------------------------
  31. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 701)
  32. Function: _transform_query
  33. 694 negate = False
  34. 695 if parts[-1] == 'not':
  35. 696 parts.pop()
  36. 697 negate = True
  37. 698
  38. 699 if _doc_cls:
  39. 700 # Switch field names to proper names [set in Field(name='foo')]
  40. 701 ==> fields = QuerySet._lookup_field(_doc_cls, parts)
  41. 702 parts = []
  42. 703
  43. 704 cleaned_fields = []
  44. 705 for field in fields:
  45. 706 append_field = True
  46. 707 if isinstance(field, basestring):
  47. Variables:
  48. mongo_query = {}
  49. _field_operation = False
  50. geo_operators =
  51. ['within_distance',
  52. 'within_spherical_distance',
  53. 'within_box',
  54. 'within_polygon',
  55. 'near',
  56. 'near_sphere']
  57. match_operators =
  58. ['contains',
  59. 'icontains',
  60. 'startswith',
  61. 'istartswith',
  62. 'endswith',
  63. 'iendswith',
  64. 'exact',
  65. 'iexact']
  66. p = 'collapse'
  67. i = 0
  68. operators =
  69. ['ne',
  70. 'gt',
  71. 'gte',
  72. 'lt',
  73. 'lte',
  74. 'in',
  75. 'nin',
  76. 'mod',
  77. 'all',
  78. 'size',
  79. 'exists',
  80. 'not']
  81. parts = ['collapse']
  82. value = u'1'
  83. indices = []
  84. _doc_cls = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  85. part = 'collapse'
  86. cls = <class 'mongoengine.queryset.QuerySet'>
  87. key = 'collapse'
  88. negate = False
  89. query = {'collapse': u'1'}
  90. custom_operators = ['match']
  91. op = None
  92. ------------------------------------------------------------------------
  93. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 162)
  94. Function: visit_query
  95. 155 if combination.operation == combination.OR:
  96. 156 return {'$or': combination.children}
  97. 157 elif combination.operation == combination.AND:
  98. 158 return self._mongo_query_conjunction(combination.children)
  99. 159 return combination
  100. 160
  101. 161 def visit_query(self, query):
  102. 162 ==> return QuerySet._transform_query(self.document, **query.query)
  103. 163
  104. 164 def _mongo_query_conjunction(self, queries):
  105. 165 """Merges Mongo query dicts - effectively &ing them together.
  106. 166 """
  107. 167 combined_query = {}
  108. 168 for query in queries:
  109. Variables:
  110. query = <mongoengine.queryset.Q object at 0x51c8110>
  111. self = <mongoengine.queryset.QueryCompilerVisitor object at 0x51c8c90>
  112. ------------------------------------------------------------------------
  113. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 270)
  114. Function: accept
  115. 263 query structures.
  116. 264 """
  117. 265
  118. 266 def __init__(self, **query):
  119. 267 self.query = query
  120. 268
  121. 269 def accept(self, visitor):
  122. 270 ==> return visitor.visit_query(self)
  123. 271
  124. 272 @property
  125. 273 def empty(self):
  126. 274 return not bool(self.query)
  127. 275
  128. 276
  129. Variables:
  130. visitor = <mongoengine.queryset.QueryCompilerVisitor object at 0x51c8c90>
  131. self = <mongoengine.queryset.Q object at 0x51c8110>
  132. ------------------------------------------------------------------------
  133. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 205)
  134. Function: to_query
  135. 198
  136. 199 AND = 0
  137. 200 OR = 1
  138. 201
  139. 202 def to_query(self, document):
  140. 203 query = self.accept(SimplificationVisitor())
  141. 204 query = query.accept(QueryTreeTransformerVisitor())
  142. 205 ==> query = query.accept(QueryCompilerVisitor(document))
  143. 206 return query
  144. 207
  145. 208 def accept(self, visitor):
  146. 209 raise NotImplementedError
  147. 210
  148. 211 def _combine(self, other, operation):
  149. Variables:
  150. query = <mongoengine.queryset.Q object at 0x51c8110>
  151. self = <mongoengine.queryset.Q object at 0x51c8110>
  152. document = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  153. ------------------------------------------------------------------------
  154. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 379)
  155. Function: _query
  156. 372 setattr(c, prop, copy.deepcopy(val))
  157. 373
  158. 374 return c
  159. 375
  160. 376 @property
  161. 377 def _query(self):
  162. 378 if self._mongo_query is None:
  163. 379 ==> self._mongo_query = self._query_obj.to_query(self._document)
  164. 380 if self._class_check:
  165. 381 self._mongo_query.update(self._initial_query)
  166. 382 return self._mongo_query
  167. 383
  168. 384 def ensure_index(self, key_or_list, drop_dups=False, background=False,
  169. 385 **kwargs):
  170. Variables:
  171. self = repr() failed
  172. ------------------------------------------------------------------------
  173. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 583)
  174. Function: _cursor
  175. 576 cursor_args['fields'] = self._loaded_fields.as_dict()
  176. 577 return cursor_args
  177. 578
  178. 579 @property
  179. 580 def _cursor(self):
  180. 581 if self._cursor_obj is None:
  181. 582
  182. 583 ==> self._cursor_obj = self._collection.find(self._query,
  183. 584 **self._cursor_args)
  184. 585 # Apply where clauses to cursor
  185. 586 if self._where_clause:
  186. 587 self._cursor_obj.where(self._where_clause)
  187. 588
  188. 589 # apply default ordering
  189. Variables:
  190. self = .. queryset mid-iteration ..
  191. ------------------------------------------------------------------------
  192. File: /opt/noc/lib/python2.6/site-packages/mongoengine/queryset.py (Line: 1277)
  193. Function: order_by
  194. 1270 try:
  195. 1271 key = QuerySet._translate_field_name(self._document, key)
  196. 1272 except:
  197. 1273 pass
  198. 1274 key_list.append((key, direction))
  199. 1275
  200. 1276 self._ordering = key_list
  201. 1277 ==> self._cursor.sort(key_list)
  202. 1278 return self
  203. 1279
  204. 1280 def explain(self, format=False):
  205. 1281 """Return an explain plan record for the
  206. 1282 :class:`~mongoengine.queryset.QuerySet`\ 's cursor.
  207. 1283
  208. Variables:
  209. key_list = [('timestamp', 1)]
  210. keys = ('timestamp',)
  211. direction = 1
  212. self = .. queryset mid-iteration ..
  213. key = 'timestamp'
  214. ------------------------------------------------------------------------
  215. File: /opt/noc/lib/app/extapplication.py (Line: 154)
  216. Function: list_data
  217. 147 data = data.filter(id__in=fav_items)
  218. 148 else:
  219. 149 data = data.exclude(id__in=fav_items)
  220. 150 if hasattr(data, "_as_sql"): # For Models only
  221. 151 data = data.select_related()
  222. 152 # Apply sorting
  223. 153 if ordering:
  224. 154 ==> data = data.order_by(*ordering)
  225. 155 if format == "ext":
  226. 156 total = data.count() # Total unpaged count
  227. 157 if start is not None and limit is not None:
  228. 158 data = data[int(start):int(start) + int(limit)]
  229. 159 ld = len(data)
  230. 160 if self.row_limit and ld > self.row_limit:
  231. Variables:
  232. fs = None
  233. format = u'ext'
  234. ordering = ['timestamp']
  235. self = <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>
  236. request =
  237. <WSGIRequest
  238. path:/fm/alarm/,
  239. GET:<QueryDict: {u'status': [u'A'], u'__limit': [u'1'], u'__start': [u'0'], u'__page': [u'1'], u'_dc': [u'1376392601110'], u'__format': [u'ext'], u'__sort': [u'[{"property":"timestamp","direction":"ASC"}]'], u'collapse': [u'1']}>,
  240. POST:<QueryDict: {}>,
  241. COOKIES:{'SESS57bccc05979d75ac356b3faf0be1ab59': 'rdkrr29clkknsa0dfaud7gnvn1',
  242. 'SESSbb33813eba54a737490d2e105cbe8ab9': 'p3tgs2382slcnokvdrbc7ogp00',
  243. '__utma': '65702700.239921621.1375362604.1375364911.1375364911.4',
  244. '__utmz': '65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
  245. 'csrftoken': '4de90f4cba93162b388cfa952c4983bf',
  246. 'sessionid': '23692d782b57a0dfb2a073ed4a0c9a40'},
  247. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  248. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  249. 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
  250. 'HTTP_CONNECTION': 'close',
  251. 'HTTP_COOKIE': 'csrftoken=4de90f4cba93162b388cfa952c4983bf; SESSbb33813eba54a737490d2e105cbe8ab9=p3tgs2382slcnokvdrbc7ogp00; __utma=65702700.239921621.1375362604.1375364911.1375364911.4; __utmz=65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); SESS57bccc05979d75ac356b3faf0be1ab59=rdkrr29clkknsa0dfaud7gnvn1; sessionid=23692d782b57a0dfb2a073ed4a0c9a40',
  252. 'HTTP_HOST': '127.0.0.1:8000',
  253. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0',
  254. 'PATH_INFO': u'/fm/alarm/',
  255. 'QUERY_STRING': '_dc=1376392601110&status=A&collapse=1&__format=ext&__page=1&__start=0&__limit=1&__sort=%5B%7B%22property%22%3A%22timestamp%22%2C%22direction%22%3A%22ASC%22%7D%5D',
  256. 'REMOTE_ADDR': '127.0.0.1',
  257. 'REQUEST_METHOD': 'GET',
  258. 'SCRIPT_NAME': u'',
  259. 'SERVER_NAME': '127.0.0.1',
  260. 'SERVER_PORT': '8000',
  261. 'SERVER_PROTOCOL': 'HTTP/1.0',
  262. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x2263c00>,
  263. 'wsgi.input': <io.BytesIO object at 0x4f8de90>,
  264. 'wsgi.multiprocess': True,
  265. 'wsgi.multithread': False,
  266. 'wsgi.run_once': False,
  267. 'wsgi.url_scheme': 'http',
  268. 'wsgi.version': (1, 0)}>
  269. q = {'collapse': u'1'}
  270. start = u'0'
  271. only = None
  272. r = {'direction': 'ASC', 'property': 'timestamp'}
  273. limit = u'1'
  274. query = None
  275. formatter =
  276. <bound method AlarmApplication.instance_to_dict of <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>>
  277. data = .. queryset mid-iteration ..
  278. fav_items = None
  279. ------------------------------------------------------------------------
  280. File: /opt/noc/fm/apps/alarm/views.py (Line: 114)
  281. Function: api_list
  282. 107 if status not in self.model_map:
  283. 108 raise Exception("Invalid status")
  284. 109 model = self.model_map[status]
  285. 110 return model.objects.all()
  286. 111
  287. 112 @view(url=r"^$", access="launch", method=["GET"], api=True)
  288. 113 def api_list(self, request):
  289. 114 ==> return self.list_data(request, self.instance_to_dict)
  290. 115
  291. 116 @view(url=r"^(?P<id>[a-z0-9]{24})/$", method=["GET"], api=True,
  292. 117 access="launch")
  293. 118 def api_alarm(self, request, id):
  294. 119 alarm = get_alarm(id)
  295. 120 if not alarm:
  296. Variables:
  297. self = <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>
  298. request =
  299. <WSGIRequest
  300. path:/fm/alarm/,
  301. GET:<QueryDict: {u'status': [u'A'], u'__limit': [u'1'], u'__start': [u'0'], u'__page': [u'1'], u'_dc': [u'1376392601110'], u'__format': [u'ext'], u'__sort': [u'[{"property":"timestamp","direction":"ASC"}]'], u'collapse': [u'1']}>,
  302. POST:<QueryDict: {}>,
  303. COOKIES:{'SESS57bccc05979d75ac356b3faf0be1ab59': 'rdkrr29clkknsa0dfaud7gnvn1',
  304. 'SESSbb33813eba54a737490d2e105cbe8ab9': 'p3tgs2382slcnokvdrbc7ogp00',
  305. '__utma': '65702700.239921621.1375362604.1375364911.1375364911.4',
  306. '__utmz': '65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
  307. 'csrftoken': '4de90f4cba93162b388cfa952c4983bf',
  308. 'sessionid': '23692d782b57a0dfb2a073ed4a0c9a40'},
  309. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  310. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  311. 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
  312. 'HTTP_CONNECTION': 'close',
  313. 'HTTP_COOKIE': 'csrftoken=4de90f4cba93162b388cfa952c4983bf; SESSbb33813eba54a737490d2e105cbe8ab9=p3tgs2382slcnokvdrbc7ogp00; __utma=65702700.239921621.1375362604.1375364911.1375364911.4; __utmz=65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); SESS57bccc05979d75ac356b3faf0be1ab59=rdkrr29clkknsa0dfaud7gnvn1; sessionid=23692d782b57a0dfb2a073ed4a0c9a40',
  314. 'HTTP_HOST': '127.0.0.1:8000',
  315. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0',
  316. 'PATH_INFO': u'/fm/alarm/',
  317. 'QUERY_STRING': '_dc=1376392601110&status=A&collapse=1&__format=ext&__page=1&__start=0&__limit=1&__sort=%5B%7B%22property%22%3A%22timestamp%22%2C%22direction%22%3A%22ASC%22%7D%5D',
  318. 'REMOTE_ADDR': '127.0.0.1',
  319. 'REQUEST_METHOD': 'GET',
  320. 'SCRIPT_NAME': u'',
  321. 'SERVER_NAME': '127.0.0.1',
  322. 'SERVER_PORT': '8000',
  323. 'SERVER_PROTOCOL': 'HTTP/1.0',
  324. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x2263c00>,
  325. 'wsgi.input': <io.BytesIO object at 0x4f8de90>,
  326. 'wsgi.multiprocess': True,
  327. 'wsgi.multithread': False,
  328. 'wsgi.run_once': False,
  329. 'wsgi.url_scheme': 'http',
  330. 'wsgi.version': (1, 0)}>
  331. ------------------------------------------------------------------------
  332. File: /opt/noc/lib/app/site.py (Line: 232)
  333. Function: inner
  334. 225 for k, v in request.POST.lists())
  335. 226 elif request.method == "GET":
  336. 227 a = dict((k, v[0] if len(v) == 1 else v)
  337. 228 for k, v in request.GET.lists())
  338. 229 logging.debug("API %s %s %s" % (request.method,
  339. 230 request.path, a))
  340. 231 # Call handler
  341. 232 ==> r = v(request, *args, **kwargs)
  342. 233 # Dump SQL statements
  343. 234 if self.log_sql_statements:
  344. 235 from django.db import connections
  345. 236 tsc = 0
  346. 237 sc = defaultdict(int)
  347. 238 for conn in connections.all():
  348. Variables:
  349. args = ()
  350. view_map =
  351. {'GET': <bound method AlarmApplication.api_list of <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>>}
  352. Form = <class 'django.forms.forms.Form'>
  353. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  354. self = <noc.lib.app.site.Site object at 0x2a8f090>
  355. v =
  356. <bound method AlarmApplication.api_list of <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>>
  357. request =
  358. <WSGIRequest
  359. path:/fm/alarm/,
  360. GET:<QueryDict: {u'status': [u'A'], u'__limit': [u'1'], u'__start': [u'0'], u'__page': [u'1'], u'_dc': [u'1376392601110'], u'__format': [u'ext'], u'__sort': [u'[{"property":"timestamp","direction":"ASC"}]'], u'collapse': [u'1']}>,
  361. POST:<QueryDict: {}>,
  362. COOKIES:{'SESS57bccc05979d75ac356b3faf0be1ab59': 'rdkrr29clkknsa0dfaud7gnvn1',
  363. 'SESSbb33813eba54a737490d2e105cbe8ab9': 'p3tgs2382slcnokvdrbc7ogp00',
  364. '__utma': '65702700.239921621.1375362604.1375364911.1375364911.4',
  365. '__utmz': '65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
  366. 'csrftoken': '4de90f4cba93162b388cfa952c4983bf',
  367. 'sessionid': '23692d782b57a0dfb2a073ed4a0c9a40'},
  368. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  369. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  370. 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
  371. 'HTTP_CONNECTION': 'close',
  372. 'HTTP_COOKIE': 'csrftoken=4de90f4cba93162b388cfa952c4983bf; SESSbb33813eba54a737490d2e105cbe8ab9=p3tgs2382slcnokvdrbc7ogp00; __utma=65702700.239921621.1375362604.1375364911.1375364911.4; __utmz=65702700.1375362604.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); SESS57bccc05979d75ac356b3faf0be1ab59=rdkrr29clkknsa0dfaud7gnvn1; sessionid=23692d782b57a0dfb2a073ed4a0c9a40',
  373. 'HTTP_HOST': '127.0.0.1:8000',
  374. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0',
  375. 'PATH_INFO': u'/fm/alarm/',
  376. 'QUERY_STRING': '_dc=1376392601110&status=A&collapse=1&__format=ext&__page=1&__start=0&__limit=1&__sort=%5B%7B%22property%22%3A%22timestamp%22%2C%22direction%22%3A%22ASC%22%7D%5D',
  377. 'REMOTE_ADDR': '127.0.0.1',
  378. 'REQUEST_METHOD': 'GET',
  379. 'SCRIPT_NAME': u'',
  380. 'SERVER_NAME': '127.0.0.1',
  381. 'SERVER_PORT': '8000',
  382. 'SERVER_PROTOCOL': 'HTTP/1.0',
  383. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x2263c00>,
  384. 'wsgi.input': <io.BytesIO object at 0x4f8de90>,
  385. 'wsgi.multiprocess': True,
  386. 'wsgi.multithread': False,
  387. 'wsgi.run_once': False,
  388. 'wsgi.url_scheme': 'http',
  389. 'wsgi.version': (1, 0)}>
  390. to_log_api_call = False
  391. InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
  392. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  393. kwargs = {}
  394. app = <noc.fm.apps.alarm.views.AlarmApplication object at 0x48cdb10>
  395. ------------------------------------------------------------------------
  396. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement