Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.61 KB | None | 0 0
  1. UNHANDLED EXCEPTION (2014-11-24 17:54:11.927955)
  2. Working directory: /opt/noc
  3. <class 'mongoengine.errors.InvalidQueryError'>
  4. Cannot resolve field "db_table"
  5. START OF TRACEBACK
  6. ------------------------------------------------------------------------
  7. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/transform.py (Line: 59)
  8. Function: query
  9. 52 negate = True
  10. 53
  11. 54 if _doc_cls:
  12. 55 # Switch field names to proper names [set in Field(name='foo')]
  13. 56 try:
  14. 57 fields = _doc_cls._lookup_field(parts)
  15. 58 except Exception, e:
  16. 59 ==> raise InvalidQueryError(e)
  17. 60 parts = []
  18. 61
  19. 62 cleaned_fields = []
  20. 63 for field in fields:
  21. 64 append_field = True
  22. 65 if isinstance(field, basestring):
  23. Variables:
  24. mongo_query = {}
  25. _field_operation = False
  26. e = LookUpError('Cannot resolve field "db_table"',)
  27. p = 'in'
  28. i = 1
  29. parts = ['db_table']
  30. value = ['ip_prefix']
  31. indices = []
  32. _doc_cls = <class 'noc.main.models.audittrail.AuditTrail'>
  33. part = 'in'
  34. key = 'db_table__in'
  35. negate = False
  36. query =
  37. {'db_table__in': ['ip_prefix'], 'timestamp__gte': datetime.date(2014, 11, 21)}
  38. merge_query = defaultdict(<type 'list'>, {})
  39. op = 'in'
  40. ------------------------------------------------------------------------
  41. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 80)
  42. Function: visit_query
  43. 73 def visit_combination(self, combination):
  44. 74 operator = "$and"
  45. 75 if combination.operation == combination.OR:
  46. 76 operator = "$or"
  47. 77 return {operator: combination.children}
  48. 78
  49. 79 def visit_query(self, query):
  50. 80 ==> return transform.query(self.document, **query.query)
  51. 81
  52. 82
  53. 83 class QNode(object):
  54. 84 """Base class for nodes in query trees.
  55. 85 """
  56. 86
  57. Variables:
  58. query = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
  59. self =
  60. <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x811a98d50>
  61. ------------------------------------------------------------------------
  62. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 157)
  63. Function: accept
  64. 150 query structures.
  65. 151 """
  66. 152
  67. 153 def __init__(self, **query):
  68. 154 self.query = query
  69. 155
  70. 156 def accept(self, visitor):
  71. 157 ==> return visitor.visit_query(self)
  72. 158
  73. 159 @property
  74. 160 def empty(self):
  75. 161 return not bool(self.query)
  76. Variables:
  77. visitor =
  78. <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x811a98d50>
  79. self = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
  80. ------------------------------------------------------------------------
  81. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 92)
  82. Function: to_query
  83. 85 """
  84. 86
  85. 87 AND = 0
  86. 88 OR = 1
  87. 89
  88. 90 def to_query(self, document):
  89. 91 query = self.accept(SimplificationVisitor())
  90. 92 ==> query = query.accept(QueryCompilerVisitor(document))
  91. 93 return query
  92. 94
  93. 95 def accept(self, visitor):
  94. 96 raise NotImplementedError
  95. 97
  96. 98 def _combine(self, other, operation):
  97. Variables:
  98. query = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
  99. self = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
  100. document = <class 'noc.main.models.audittrail.AuditTrail'>
  101. ------------------------------------------------------------------------
  102. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1215)
  103. Function: _query
  104. 1208 def __deepcopy__(self, memo):
  105. 1209 """Essential for chained queries with ReferenceFields involved"""
  106. 1210 return self.clone()
  107. 1211
  108. 1212 @property
  109. 1213 def _query(self):
  110. 1214 if self._mongo_query is None:
  111. 1215 ==> self._mongo_query = self._query_obj.to_query(self._document)
  112. 1216 if self._class_check:
  113. 1217 self._mongo_query.update(self._initial_query)
  114. 1218 return self._mongo_query
  115. 1219
  116. 1220 @property
  117. 1221 def _dereference(self):
  118. Variables:
  119. self = .. queryset mid-iteration ..
  120. ------------------------------------------------------------------------
  121. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1182)
  122. Function: _cursor
  123. 1175 cursor_args['fields'] = self._loaded_fields.as_dict()
  124. 1176 return cursor_args
  125. 1177
  126. 1178 @property
  127. 1179 def _cursor(self):
  128. 1180 if self._cursor_obj is None:
  129. 1181
  130. 1182 ==> self._cursor_obj = self._collection.find(self._query,
  131. 1183 **self._cursor_args)
  132. 1184 # Apply where clauses to cursor
  133. 1185 if self._where_clause:
  134. 1186 where_clause = self._sub_js_fields(self._where_clause)
  135. 1187 self._cursor_obj.where(where_clause)
  136. 1188
  137. Variables:
  138. self = .. queryset mid-iteration ..
  139. ------------------------------------------------------------------------
  140. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1137)
  141. Function: next
  142. 1130
  143. 1131 def next(self):
  144. 1132 """Wrap the result in a :class:`~mongoengine.Document` object.
  145. 1133 """
  146. 1134 if self._limit == 0 or self._none:
  147. 1135 raise StopIteration
  148. 1136
  149. 1137 ==> raw_doc = self._cursor.next()
  150. 1138 if self._as_pymongo:
  151. 1139 return self._get_as_pymongo(raw_doc)
  152. 1140 doc = self._document._from_son(raw_doc,
  153. 1141 _auto_dereference=self._auto_dereference)
  154. 1142 if self._scalar:
  155. 1143 return self._get_scalar(doc)
  156. Variables:
  157. self = .. queryset mid-iteration ..
  158. ------------------------------------------------------------------------
  159. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/queryset.py (Line: 93)
  160. Function: _populate_cache
  161. 86 (until the cursor is exhausted).
  162. 87 """
  163. 88 if self._result_cache is None:
  164. 89 self._result_cache = []
  165. 90 if self._has_more:
  166. 91 try:
  167. 92 for i in xrange(ITER_CHUNK_SIZE):
  168. 93 ==> self._result_cache.append(self.next())
  169. 94 except StopIteration:
  170. 95 self._has_more = False
  171. 96
  172. 97 def count(self, with_limit_and_skip=True):
  173. 98 """Count the selected elements in the query.
  174. 99
  175. Variables:
  176. i = 0
  177. self = .. queryset mid-iteration ..
  178. ------------------------------------------------------------------------
  179. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/queryset.py (Line: 81)
  180. Function: _iter_results
  181. 74 upper = len(self._result_cache)
  182. 75 while pos < upper:
  183. 76 yield self._result_cache[pos]
  184. 77 pos = pos + 1
  185. 78 if not self._has_more:
  186. 79 raise StopIteration
  187. 80 if len(self._result_cache) <= pos:
  188. 81 ==> self._populate_cache()
  189. 82
  190. 83 def _populate_cache(self):
  191. 84 """
  192. 85 Populates the result cache with ``ITER_CHUNK_SIZE`` more entries
  193. 86 (until the cursor is exhausted).
  194. 87 """
  195. Variables:
  196. upper = 0
  197. self = .. queryset mid-iteration ..
  198. pos = 0
  199. ------------------------------------------------------------------------
  200. File: /opt/noc/lib/python2.7/site-packages/mongoengine/dereference.py (Line: 31)
  201. Function: __call__
  202. 24 """
  203. 25 if items is None or isinstance(items, basestring):
  204. 26 return items
  205. 27
  206. 28 # cheapest way to convert a queryset to a list
  207. 29 # list(queryset) uses a count() query to determine length
  208. 30 if isinstance(items, QuerySet):
  209. 31 ==> items = [i for i in items]
  210. 32
  211. 33 self.max_depth = max_depth
  212. 34 doc_type = None
  213. 35
  214. 36 if instance and isinstance(instance, (Document, EmbeddedDocument,
  215. 37 TopLevelDocumentMetaclass)):
  216. Variables:
  217. instance = None
  218. self = <mongoengine.dereference.DeReference object at 0x811a98410>
  219. items = .. queryset mid-iteration ..
  220. name = None
  221. max_depth = 2
  222. ------------------------------------------------------------------------
  223. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 565)
  224. Function: select_related
  225. 558 the number queries to mongodb.
  226. 559
  227. 560 .. versionadded:: 0.5
  228. 561 """
  229. 562 # Make select related work the same for querysets
  230. 563 max_depth += 1
  231. 564 queryset = self.clone()
  232. 565 ==> return queryset._dereference(queryset, max_depth=max_depth)
  233. 566
  234. 567 def limit(self, n):
  235. 568 """Limit the number of returned documents to `n`. This may also be
  236. 569 achieved using array-slicing syntax (e.g. ``User.objects[:5]``).
  237. 570
  238. 571 :param n: the maximum number of objects to return
  239. Variables:
  240. self = repr() failed
  241. queryset = .. queryset mid-iteration ..
  242. max_depth = 2
  243. ------------------------------------------------------------------------
  244. File: /opt/noc/ip/apps/reporthistory/views.py (Line: 58)
  245. Function: get_data
  246. 51 scope += ["ip_prefix"]
  247. 52 if include_addresses:
  248. 53 scope += ["ip_address"]
  249. 54 last = None
  250. 55 r = []
  251. 56 for l in AuditTrail.objects.filter(timestamp__gte=dt,
  252. 57 db_table__in=scope)\
  253. 58 ==> .order_by("-timestamp")\
  254. 59 .select_related():
  255. 60 d = l.timestamp.date()
  256. 61 if d != last:
  257. 62 last = d
  258. 63 r += [SectionRow(d.isoformat())]
  259. 64 r += [(
  260. Variables:
  261. last = None
  262. self =
  263. <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
  264. include_addresses = False
  265. days = 3
  266. include_prefixes = True
  267. r = []
  268. kwargs = {}
  269. scope = ['ip_prefix']
  270. dt = datetime.date(2014, 11, 21)
  271. ------------------------------------------------------------------------
  272. File: /opt/noc/lib/app/simplereport.py (Line: 635)
  273. Function: report_html
  274. 628 """
  275. 629 return Report()
  276. 630
  277. 631 def report_html(self, **kwargs):
  278. 632 """
  279. 633 Render HTML
  280. 634 """
  281. 635 ==> return self.get_data(**kwargs).to_html()
  282. 636
  283. 637 def report_csv(self, **kwargs):
  284. 638 """
  285. 639 Render CSV
  286. 640 """
  287. 641 return self.get_data(**kwargs).to_csv()
  288. Variables:
  289. self =
  290. <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
  291. kwargs = {'include_prefixes': True, 'include_addresses': False, 'days': 3}
  292. ------------------------------------------------------------------------
  293. File: /opt/noc/lib/app/reportapplication.py (Line: 81)
  294. Function: view_report
  295. 74 else:
  296. 75 form = form_class()
  297. 76 # No POST or error - render form
  298. 77 if not query:
  299. 78 return self.render(request, "report_form.html",
  300. 79 form=form, app=self, is_report=True)
  301. 80 # Build result
  302. 81 ==> rdata = getattr(self, "report_%s" % format)(**query)
  303. 82 # Render result
  304. 83 if format == "html":
  305. 84 return self.render(request, "report.html",
  306. 85 data=rdata, app=self, is_report=True)
  307. 86 else:
  308. 87 return self.render_response(rdata,
  309. Variables:
  310. form = <noc.ip.apps.reporthistory.views.form object at 0x8121f2090>
  311. format = 'html'
  312. self =
  313. <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
  314. request =
  315. <WSGIRequest
  316. path:/ip/reporthistory/,
  317. GET:<QueryDict: {}>,
  318. POST:<QueryDict: {u'include_prefixes': [u'on'], u'days': [u'3']}>,
  319. COOKIES:{'csrftoken': 'Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc',
  320. 'sessionid': 'ca1c0d94710bc658970c38994269a845'},
  321. META:{'CONTENT_LENGTH': '26',
  322. 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
  323. 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  324. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  325. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
  326. 'HTTP_CONNECTION': 'close',
  327. 'HTTP_COOKIE': 'csrftoken=Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc; sessionid=ca1c0d94710bc658970c38994269a845',
  328. 'HTTP_HOST': 'noc',
  329. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0',
  330. 'HTTP_X_SCHEME': 'http',
  331. 'PATH_INFO': u'/ip/reporthistory/',
  332. 'QUERY_STRING': '',
  333. 'REMOTE_ADDR': '127.0.0.1',
  334. 'REQUEST_METHOD': 'POST',
  335. 'SCRIPT_NAME': u'',
  336. 'SERVER_NAME': 'noc',
  337. 'SERVER_PORT': '80',
  338. 'SERVER_PROTOCOL': 'HTTP/1.0',
  339. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x808f8bb70>,
  340. 'wsgi.input': <_io.BytesIO object at 0x812184170>,
  341. 'wsgi.multiprocess': True,
  342. 'wsgi.multithread': False,
  343. 'wsgi.run_once': False,
  344. 'wsgi.url_scheme': 'http',
  345. 'wsgi.version': (1, 0)}>
  346. form_class = <class 'noc.ip.apps.reporthistory.views.form'>
  347. query = {'include_prefixes': True, 'include_addresses': False, 'days': 3}
  348. ------------------------------------------------------------------------
  349. File: /opt/noc/lib/app/site.py (Line: 248)
  350. Function: inner
  351. 241 a = dict((k, v[0] if len(v) == 1 else v)
  352. 242 for k, v in request.GET.lists())
  353. 243 app_logger.debug("API %s %s %s",
  354. 244 request.method, request.path, a)
  355. 245 # Call handler
  356. 246 v.__dict__["hits_metric"] += 1
  357. 247 with v.__dict__["time_metric"].timer():
  358. 248 ==> r = v(request, *args, **kwargs)
  359. 249 # Dump SQL statements
  360. 250 if self.log_sql_statements:
  361. 251 from django.db import connections
  362. 252 tsc = 0
  363. 253 sc = defaultdict(int)
  364. 254 for conn in connections.all():
  365. Variables:
  366. args = ()
  367. view_map =
  368. {'DELETE': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
  369. 'GET': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
  370. 'POST': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
  371. 'PUT': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>}
  372. Form = <class 'django.forms.forms.Form'>
  373. PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
  374. DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
  375. self = <noc.lib.app.site.Site object at 0x80d55f550>
  376. v =
  377. <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>
  378. request =
  379. <WSGIRequest
  380. path:/ip/reporthistory/,
  381. GET:<QueryDict: {}>,
  382. POST:<QueryDict: {u'include_prefixes': [u'on'], u'days': [u'3']}>,
  383. COOKIES:{'csrftoken': 'Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc',
  384. 'sessionid': 'ca1c0d94710bc658970c38994269a845'},
  385. META:{'CONTENT_LENGTH': '26',
  386. 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
  387. 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  388. 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
  389. 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
  390. 'HTTP_CONNECTION': 'close',
  391. 'HTTP_COOKIE': 'csrftoken=Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc; sessionid=ca1c0d94710bc658970c38994269a845',
  392. 'HTTP_HOST': 'noc',
  393. 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0',
  394. 'HTTP_X_SCHEME': 'http',
  395. 'PATH_INFO': u'/ip/reporthistory/',
  396. 'QUERY_STRING': '',
  397. 'REMOTE_ADDR': '127.0.0.1',
  398. 'REQUEST_METHOD': 'POST',
  399. 'SCRIPT_NAME': u'',
  400. 'SERVER_NAME': 'noc',
  401. 'SERVER_PORT': '80',
  402. 'SERVER_PROTOCOL': 'HTTP/1.0',
  403. 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x808f8bb70>,
  404. 'wsgi.input': <_io.BytesIO object at 0x812184170>,
  405. 'wsgi.multiprocess': True,
  406. 'wsgi.multithread': False,
  407. 'wsgi.run_once': False,
  408. 'wsgi.url_scheme': 'http',
  409. 'wsgi.version': (1, 0)}>
  410. app_logger = <logging.Logger object at 0x811483d90>
  411. InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
  412. to_log_api_call = False
  413. kwargs = {}
  414. nq = <function nq at 0x81232fc80>
  415. app =
  416. <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
  417. ------------------------------------------------------------------------
  418. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement