Advertisement
Guest User

Untitled

a guest
Aug 19th, 2014
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.97 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2014-08-19 10:05:38.275515)
  2. Working directory: /opt/noc
  3. <class 'mongoengine.queryset.InvalidQueryError'>
  4. Cannot resolve field "is_builtin"
  5. START OF TRACEBACK
  6. ------------------------------------------------------------------------
  7. File: /opt/noc/lib/python2.7/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 = ['is_builtin']
  27. document = <class 'noc.fm.models.alarmclass.AlarmClass'>
  28. field_name = 'is_builtin'
  29. cls = <class 'mongoengine.queryset.QuerySet'>
  30. ------------------------------------------------------------------------
  31. File: /opt/noc/lib/python2.7/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 = 'is_builtin'
  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 = ['is_builtin']
  82. value = True
  83. indices = []
  84. _doc_cls = <class 'noc.fm.models.alarmclass.AlarmClass'>
  85. part = 'is_builtin'
  86. cls = <class 'mongoengine.queryset.QuerySet'>
  87. key = 'is_builtin'
  88. negate = False
  89. query = {'is_builtin': True}
  90. custom_operators = ['match']
  91. op = None
  92. ------------------------------------------------------------------------
  93. File: /opt/noc/lib/python2.7/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 0x681fd90>
  111. self = <mongoengine.queryset.QueryCompilerVisitor object at 0x681fe10>
  112. ------------------------------------------------------------------------
  113. File: /opt/noc/lib/python2.7/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 0x681fe10>
  131. self = <mongoengine.queryset.Q object at 0x681fd90>
  132. ------------------------------------------------------------------------
  133. File: /opt/noc/lib/python2.7/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 0x681fd90>
  151. self = <mongoengine.queryset.Q object at 0x681fd90>
  152. document = <class 'noc.fm.models.alarmclass.AlarmClass'>
  153. ------------------------------------------------------------------------
  154. File: /opt/noc/lib/python2.7/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.7/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.7/site-packages/mongoengine/queryset.py (Line: 997)
  193. Function: count
  194. 990 self._cursor.rewind()
  195. 991
  196. 992 def count(self):
  197. 993 """Count the selected elements in the query.
  198. 994 """
  199. 995 if self._limit == 0:
  200. 996 return 0
  201. 997 ==> return self._cursor.count(with_limit_and_skip=True)
  202. 998
  203. 999 def __len__(self):
  204. 1000 return self.count()
  205. 1001
  206. 1002 def map_reduce(self, map_f, reduce_f, output, finalize_f=None, limit=None,
  207. 1003 scope=None):
  208. Variables:
  209. self = .. queryset mid-iteration ..
  210. ------------------------------------------------------------------------
  211. File: /opt/noc/fm/apps/reportrulesetsummary/views.py (Line: 20)
  212. Function: get_count
  213. 13
  214. 14 class ReportRulesetSummary(SimpleReport):
  215. 15 title = "Ruleset Summary"
  216. 16
  217. 17 def get_data(self, **kwargs):
  218. 18 def get_count(m):
  219. 19 total = m.objects.count()
  220. 20 ==> builtin = m.objects.filter(is_builtin=True).count()
  221. 21 local = total - builtin
  222. 22 return [builtin, local, total]
  223. 23
  224. 24 data = [
  225. 25 ["Alarm Classes"] + get_count(AlarmClass),
  226. 26 ["Event Classies"] + get_count(EventClass),
  227. Variables:
  228. total = 111
  229. m = <class 'noc.fm.models.alarmclass.AlarmClass'>
  230. ------------------------------------------------------------------------
  231. File: /opt/noc/fm/apps/reportrulesetsummary/views.py (Line: 25)
  232. Function: get_data
  233. 18 def get_count(m):
  234. 19 total = m.objects.count()
  235. 20 builtin = m.objects.filter(is_builtin=True).count()
  236. 21 local = total - builtin
  237. 22 return [builtin, local, total]
  238. 23
  239. 24 data = [
  240. 25 ==> ["Alarm Classes"] + get_count(AlarmClass),
  241. 26 ["Event Classies"] + get_count(EventClass),
  242. 27 ["Classification Rules"] + get_count(EventClassificationRule)
  243. 28 ]
  244. 29
  245. 30 return self.from_dataset(title=self.title,
  246. 31 columns=["",
  247. Variables:
  248. get_count = <function get_count at 0x667c230>
  249. self =
  250. <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>
  251. kwargs = {}
  252. ------------------------------------------------------------------------
  253. File: /opt/noc/lib/app/simplereport.py (Line: 635)
  254. Function: report_html
  255. 628 """
  256. 629 return Report()
  257. 630
  258. 631 def report_html(self, **kwargs):
  259. 632 """
  260. 633 Render HTML
  261. 634 """
  262. 635 ==> return self.get_data(**kwargs).to_html()
  263. 636
  264. 637 def report_csv(self, **kwargs):
  265. 638 """
  266. 639 Render CSV
  267. 640 """
  268. 641 return self.get_data(**kwargs).to_csv()
  269. Variables:
  270. self =
  271. <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>
  272. kwargs = {}
  273. ------------------------------------------------------------------------
  274. File: /opt/noc/lib/app/reportapplication.py (Line: 81)
  275. Function: view_report
  276. 74 else:
  277. 75 form = form_class()
  278. 76 # No POST or error - render form
  279. 77 if not query:
  280. 78 return self.render(request, "report_form.html",
  281. 79 form=form, app=self, is_report=True)
  282. 80 # Build result
  283. 81 ==> rdata = getattr(self, "report_%s" % format)(**query)
  284. 82 # Render result
  285. 83 if format == "html":
  286. 84 return self.render(request, "report.html",
  287. 85 data=rdata, app=self, is_report=True)
  288. 86 else:
  289. 87 return self.render_response(rdata,
  290. Variables:
  291. query = {}
  292. self =
  293. <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>
  294. request =
  295. <WSGIRequest
  296. path:/fm/reportrulesetsummary/,
  297. GET:<QueryDict: {}>,
  298. POST:<QueryDict: {}>,
  299. COOKIES:{'csrftoken': 'itfUJgzKyDtYuTD8T2KaQUMfzuLQzMk1',
  300. 'sessionid': '90caf5ab9e145adcafbe3b624d91e1b0'},
  301. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  302. 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,lzma,sdch',
  303. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
  304. 'HTTP_CONNECTION': 'close',
  305. 'HTTP_COOKIE': 'sessionid=90caf5ab9e145adcafbe3b624d91e1b0; csrftoken=itfUJgzKyDtYuTD8T2KaQUMfzuLQzMk1',
  306. 'HTTP_HOST': '127.0.0.1:8000',
  307. 'HTTP_REFERER': 'http://192.168.192.145/main/desktop/',
  308. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 OPR/23.0.1522.75',
  309. 'PATH_INFO': u'/fm/reportrulesetsummary/',
  310. 'QUERY_STRING': '',
  311. 'REMOTE_ADDR': '127.0.0.1',
  312. 'REQUEST_METHOD': 'GET',
  313. 'SCRIPT_NAME': u'',
  314. 'SERVER_NAME': '127.0.0.1',
  315. 'SERVER_PORT': '8000',
  316. 'SERVER_PROTOCOL': 'HTTP/1.0',
  317. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x321adb0>,
  318. 'wsgi.input': <_io.BytesIO object at 0x6747dd0>,
  319. 'wsgi.multiprocess': True,
  320. 'wsgi.multithread': False,
  321. 'wsgi.run_once': False,
  322. 'wsgi.url_scheme': 'http',
  323. 'wsgi.version': (1, 0)}>
  324. form_class = None
  325. format = 'html'
  326. ------------------------------------------------------------------------
  327. File: /opt/noc/lib/app/site.py (Line: 233)
  328. Function: inner
  329. 226 for k, v in request.POST.lists())
  330. 227 elif request.method == "GET":
  331. 228 a = dict((k, v[0] if len(v) == 1 else v)
  332. 229 for k, v in request.GET.lists())
  333. 230 logging.debug("API %s %s %s" % (request.method,
  334. 231 request.path, a))
  335. 232 # Call handler
  336. 233 ==> r = v(request, *args, **kwargs)
  337. 234 # Dump SQL statements
  338. 235 if self.log_sql_statements:
  339. 236 from django.db import connections
  340. 237 tsc = 0
  341. 238 sc = defaultdict(int)
  342. 239 for conn in connections.all():
  343. Variables:
  344. args = ()
  345. view_map =
  346. {'DELETE': <bound method ReportRulesetSummary.view_report of <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>>,
  347. 'GET': <bound method ReportRulesetSummary.view_report of <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>>,
  348. 'POST': <bound method ReportRulesetSummary.view_report of <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>>,
  349. 'PUT': <bound method ReportRulesetSummary.view_report of <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>>}
  350. Form = <class 'django.forms.forms.Form'>
  351. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  352. self = <noc.lib.app.site.Site object at 0x3c73e10>
  353. v =
  354. <bound method ReportRulesetSummary.view_report of <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>>
  355. request =
  356. <WSGIRequest
  357. path:/fm/reportrulesetsummary/,
  358. GET:<QueryDict: {}>,
  359. POST:<QueryDict: {}>,
  360. COOKIES:{'csrftoken': 'itfUJgzKyDtYuTD8T2KaQUMfzuLQzMk1',
  361. 'sessionid': '90caf5ab9e145adcafbe3b624d91e1b0'},
  362. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
  363. 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,lzma,sdch',
  364. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
  365. 'HTTP_CONNECTION': 'close',
  366. 'HTTP_COOKIE': 'sessionid=90caf5ab9e145adcafbe3b624d91e1b0; csrftoken=itfUJgzKyDtYuTD8T2KaQUMfzuLQzMk1',
  367. 'HTTP_HOST': '127.0.0.1:8000',
  368. 'HTTP_REFERER': 'http://192.168.192.145/main/desktop/',
  369. 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 OPR/23.0.1522.75',
  370. 'PATH_INFO': u'/fm/reportrulesetsummary/',
  371. 'QUERY_STRING': '',
  372. 'REMOTE_ADDR': '127.0.0.1',
  373. 'REQUEST_METHOD': 'GET',
  374. 'SCRIPT_NAME': u'',
  375. 'SERVER_NAME': '127.0.0.1',
  376. 'SERVER_PORT': '8000',
  377. 'SERVER_PROTOCOL': 'HTTP/1.0',
  378. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x321adb0>,
  379. 'wsgi.input': <_io.BytesIO object at 0x6747dd0>,
  380. 'wsgi.multiprocess': True,
  381. 'wsgi.multithread': False,
  382. 'wsgi.run_once': False,
  383. 'wsgi.url_scheme': 'http',
  384. 'wsgi.version': (1, 0)}>
  385. to_log_api_call = False
  386. InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
  387. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  388. kwargs = {}
  389. app =
  390. <noc.fm.apps.reportrulesetsummary.views.ReportRulesetSummary object at 0x60b85d0>
  391. ------------------------------------------------------------------------
  392. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement