Guest User

Untitled

a guest
Mar 30th, 2014
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.58 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2014-03-30 16:24:30.952257)
  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.eventclassificationrule.EventClassificationRule'>
  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 = False
  83. indices = []
  84. _doc_cls = <class 'noc.fm.models.eventclassificationrule.EventClassificationRule'>
  85. part = 'is_builtin'
  86. cls = <class 'mongoengine.queryset.QuerySet'>
  87. key = 'is_builtin'
  88. negate = False
  89. query = {'is_builtin': False}
  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 0x68d0cd0>
  111. self = <mongoengine.queryset.QueryCompilerVisitor object at 0x68d0a50>
  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 0x68d0a50>
  131. self = <mongoengine.queryset.Q object at 0x68d0cd0>
  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 0x68d0cd0>
  151. self = <mongoengine.queryset.Q object at 0x68d0cd0>
  152. document = <class 'noc.fm.models.eventclassificationrule.EventClassificationRule'>
  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: 990)
  193. Function: rewind
  194. 983
  195. 984 def rewind(self):
  196. 985 """Rewind the cursor to its unevaluated state.
  197. 986
  198. 987 .. versionadded:: 0.3
  199. 988 """
  200. 989 self._iter = False
  201. 990 ==> self._cursor.rewind()
  202. 991
  203. 992 def count(self):
  204. 993 """Count the selected elements in the query.
  205. 994 """
  206. 995 if self._limit == 0:
  207. 996 return 0
  208. Variables:
  209. self = .. queryset mid-iteration ..
  210. ------------------------------------------------------------------------
  211. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset.py (Line: 1517)
  212. Function: __iter__
  213. 1510
  214. 1511 if ret is not None and 'n' in ret:
  215. 1512 return ret['n']
  216. 1513 except pymongo.errors.OperationFailure, e:
  217. 1514 raise OperationError(u'Update failed [%s]' % unicode(e))
  218. 1515
  219. 1516 def __iter__(self):
  220. 1517 ==> self.rewind()
  221. 1518 return self
  222. 1519
  223. 1520 def _get_scalar(self, doc):
  224. 1521
  225. 1522 def lookup(obj, name):
  226. 1523 chunks = name.split('__')
  227. Variables:
  228. self = .. queryset mid-iteration ..
  229. ------------------------------------------------------------------------
  230. File: /opt/noc/fm/apps/reportlocalrules/views.py (Line: 22)
  231. Function: report_html
  232. 15
  233. 16 class ReportClassificationRules(ReportApplication):
  234. 17 title = "Local Classification Rules (JSON)"
  235. 18
  236. 19 def report_html(self):
  237. 20 r = ["["]
  238. 21 r += [",\n".join([indent(r.to_json())
  239. 22 ==> for r in EventClassificationRule.objects.filter(is_builtin=False)])]
  240. 23 r += ["]",""]
  241. 24 return "<pre>" + escape("\n".join(r)) + "</pre>"
  242. Variables:
  243. self =
  244. <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>
  245. r = ['[']
  246. ------------------------------------------------------------------------
  247. File: /opt/noc/lib/app/reportapplication.py (Line: 81)
  248. Function: view_report
  249. 74 else:
  250. 75 form = form_class()
  251. 76 # No POST or error - render form
  252. 77 if not query:
  253. 78 return self.render(request, "report_form.html",
  254. 79 form=form, app=self, is_report=True)
  255. 80 # Build result
  256. 81 ==> rdata = getattr(self, "report_%s" % format)(**query)
  257. 82 # Render result
  258. 83 if format == "html":
  259. 84 return self.render(request, "report.html",
  260. 85 data=rdata, app=self, is_report=True)
  261. 86 else:
  262. 87 return self.render_response(rdata,
  263. Variables:
  264. query = {}
  265. self =
  266. <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>
  267. request =
  268. <WSGIRequest
  269. path:/fm/reportlocalrules/,
  270. GET:<QueryDict: {}>,
  271. POST:<QueryDict: {}>,
  272. COOKIES:{'sessionid': 'c61dac282d554ec640a9a3d665701442'},
  273. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  274. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  275. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
  276. 'HTTP_CONNECTION': 'close',
  277. 'HTTP_COOKIE': 'sessionid=c61dac282d554ec640a9a3d665701442',
  278. 'HTTP_HOST': '127.0.0.1:8000',
  279. 'HTTP_REFERER': 'http://192.168.0.251/main/desktop/',
  280. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0',
  281. 'PATH_INFO': u'/fm/reportlocalrules/',
  282. 'QUERY_STRING': '',
  283. 'REMOTE_ADDR': '127.0.0.1',
  284. 'REQUEST_METHOD': 'GET',
  285. 'SCRIPT_NAME': u'',
  286. 'SERVER_NAME': '127.0.0.1',
  287. 'SERVER_PORT': '8000',
  288. 'SERVER_PROTOCOL': 'HTTP/1.0',
  289. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x2deff60>,
  290. 'wsgi.input': <_io.BytesIO object at 0x6d0c170>,
  291. 'wsgi.multiprocess': True,
  292. 'wsgi.multithread': False,
  293. 'wsgi.run_once': False,
  294. 'wsgi.url_scheme': 'http',
  295. 'wsgi.version': (1, 0)}>
  296. form_class = None
  297. format = 'html'
  298. ------------------------------------------------------------------------
  299. File: /opt/noc/lib/app/site.py (Line: 232)
  300. Function: inner
  301. 225 for k, v in request.POST.lists())
  302. 226 elif request.method == "GET":
  303. 227 a = dict((k, v[0] if len(v) == 1 else v)
  304. 228 for k, v in request.GET.lists())
  305. 229 logging.debug("API %s %s %s" % (request.method,
  306. 230 request.path, a))
  307. 231 # Call handler
  308. 232 ==> r = v(request, *args, **kwargs)
  309. 233 # Dump SQL statements
  310. 234 if self.log_sql_statements:
  311. 235 from django.db import connections
  312. 236 tsc = 0
  313. 237 sc = defaultdict(int)
  314. 238 for conn in connections.all():
  315. Variables:
  316. args = ()
  317. view_map =
  318. {'DELETE': <bound method ReportClassificationRules.view_report of <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>>,
  319. 'GET': <bound method ReportClassificationRules.view_report of <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>>,
  320. 'POST': <bound method ReportClassificationRules.view_report of <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>>,
  321. 'PUT': <bound method ReportClassificationRules.view_report of <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>>}
  322. Form = <class 'django.forms.forms.Form'>
  323. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  324. self = <noc.lib.app.site.Site object at 0x37d57d0>
  325. v =
  326. <bound method ReportClassificationRules.view_report of <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>>
  327. request =
  328. <WSGIRequest
  329. path:/fm/reportlocalrules/,
  330. GET:<QueryDict: {}>,
  331. POST:<QueryDict: {}>,
  332. COOKIES:{'sessionid': 'c61dac282d554ec640a9a3d665701442'},
  333. META:{'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  334. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  335. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
  336. 'HTTP_CONNECTION': 'close',
  337. 'HTTP_COOKIE': 'sessionid=c61dac282d554ec640a9a3d665701442',
  338. 'HTTP_HOST': '127.0.0.1:8000',
  339. 'HTTP_REFERER': 'http://192.168.0.251/main/desktop/',
  340. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0',
  341. 'PATH_INFO': u'/fm/reportlocalrules/',
  342. 'QUERY_STRING': '',
  343. 'REMOTE_ADDR': '127.0.0.1',
  344. 'REQUEST_METHOD': 'GET',
  345. 'SCRIPT_NAME': u'',
  346. 'SERVER_NAME': '127.0.0.1',
  347. 'SERVER_PORT': '8000',
  348. 'SERVER_PROTOCOL': 'HTTP/1.0',
  349. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x2deff60>,
  350. 'wsgi.input': <_io.BytesIO object at 0x6d0c170>,
  351. 'wsgi.multiprocess': True,
  352. 'wsgi.multithread': False,
  353. 'wsgi.run_once': False,
  354. 'wsgi.url_scheme': 'http',
  355. 'wsgi.version': (1, 0)}>
  356. InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
  357. to_log_api_call = False
  358. kwargs = {}
  359. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  360. app =
  361. <noc.fm.apps.reportlocalrules.views.ReportClassificationRules object at 0x5caa390>
  362. ------------------------------------------------------------------------
  363. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment