Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UNHANDLED EXCEPTION (2014-11-24 17:54:11.927955)
- Working directory: /opt/noc
- <class 'mongoengine.errors.InvalidQueryError'>
- Cannot resolve field "db_table"
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/transform.py (Line: 59)
- Function: query
- 52 negate = True
- 53
- 54 if _doc_cls:
- 55 # Switch field names to proper names [set in Field(name='foo')]
- 56 try:
- 57 fields = _doc_cls._lookup_field(parts)
- 58 except Exception, e:
- 59 ==> raise InvalidQueryError(e)
- 60 parts = []
- 61
- 62 cleaned_fields = []
- 63 for field in fields:
- 64 append_field = True
- 65 if isinstance(field, basestring):
- Variables:
- mongo_query = {}
- _field_operation = False
- e = LookUpError('Cannot resolve field "db_table"',)
- p = 'in'
- i = 1
- parts = ['db_table']
- value = ['ip_prefix']
- indices = []
- _doc_cls = <class 'noc.main.models.audittrail.AuditTrail'>
- part = 'in'
- key = 'db_table__in'
- negate = False
- query =
- {'db_table__in': ['ip_prefix'], 'timestamp__gte': datetime.date(2014, 11, 21)}
- merge_query = defaultdict(<type 'list'>, {})
- op = 'in'
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 80)
- Function: visit_query
- 73 def visit_combination(self, combination):
- 74 operator = "$and"
- 75 if combination.operation == combination.OR:
- 76 operator = "$or"
- 77 return {operator: combination.children}
- 78
- 79 def visit_query(self, query):
- 80 ==> return transform.query(self.document, **query.query)
- 81
- 82
- 83 class QNode(object):
- 84 """Base class for nodes in query trees.
- 85 """
- 86
- Variables:
- query = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
- self =
- <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x811a98d50>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 157)
- Function: accept
- 150 query structures.
- 151 """
- 152
- 153 def __init__(self, **query):
- 154 self.query = query
- 155
- 156 def accept(self, visitor):
- 157 ==> return visitor.visit_query(self)
- 158
- 159 @property
- 160 def empty(self):
- 161 return not bool(self.query)
- Variables:
- visitor =
- <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x811a98d50>
- self = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 92)
- Function: to_query
- 85 """
- 86
- 87 AND = 0
- 88 OR = 1
- 89
- 90 def to_query(self, document):
- 91 query = self.accept(SimplificationVisitor())
- 92 ==> query = query.accept(QueryCompilerVisitor(document))
- 93 return query
- 94
- 95 def accept(self, visitor):
- 96 raise NotImplementedError
- 97
- 98 def _combine(self, other, operation):
- Variables:
- query = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
- self = <mongoengine.queryset.visitor.Q object at 0x811a7c590>
- document = <class 'noc.main.models.audittrail.AuditTrail'>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1215)
- Function: _query
- 1208 def __deepcopy__(self, memo):
- 1209 """Essential for chained queries with ReferenceFields involved"""
- 1210 return self.clone()
- 1211
- 1212 @property
- 1213 def _query(self):
- 1214 if self._mongo_query is None:
- 1215 ==> self._mongo_query = self._query_obj.to_query(self._document)
- 1216 if self._class_check:
- 1217 self._mongo_query.update(self._initial_query)
- 1218 return self._mongo_query
- 1219
- 1220 @property
- 1221 def _dereference(self):
- Variables:
- self = .. queryset mid-iteration ..
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1182)
- Function: _cursor
- 1175 cursor_args['fields'] = self._loaded_fields.as_dict()
- 1176 return cursor_args
- 1177
- 1178 @property
- 1179 def _cursor(self):
- 1180 if self._cursor_obj is None:
- 1181
- 1182 ==> self._cursor_obj = self._collection.find(self._query,
- 1183 **self._cursor_args)
- 1184 # Apply where clauses to cursor
- 1185 if self._where_clause:
- 1186 where_clause = self._sub_js_fields(self._where_clause)
- 1187 self._cursor_obj.where(where_clause)
- 1188
- Variables:
- self = .. queryset mid-iteration ..
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1137)
- Function: next
- 1130
- 1131 def next(self):
- 1132 """Wrap the result in a :class:`~mongoengine.Document` object.
- 1133 """
- 1134 if self._limit == 0 or self._none:
- 1135 raise StopIteration
- 1136
- 1137 ==> raw_doc = self._cursor.next()
- 1138 if self._as_pymongo:
- 1139 return self._get_as_pymongo(raw_doc)
- 1140 doc = self._document._from_son(raw_doc,
- 1141 _auto_dereference=self._auto_dereference)
- 1142 if self._scalar:
- 1143 return self._get_scalar(doc)
- Variables:
- self = .. queryset mid-iteration ..
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/queryset.py (Line: 93)
- Function: _populate_cache
- 86 (until the cursor is exhausted).
- 87 """
- 88 if self._result_cache is None:
- 89 self._result_cache = []
- 90 if self._has_more:
- 91 try:
- 92 for i in xrange(ITER_CHUNK_SIZE):
- 93 ==> self._result_cache.append(self.next())
- 94 except StopIteration:
- 95 self._has_more = False
- 96
- 97 def count(self, with_limit_and_skip=True):
- 98 """Count the selected elements in the query.
- 99
- Variables:
- i = 0
- self = .. queryset mid-iteration ..
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/queryset.py (Line: 81)
- Function: _iter_results
- 74 upper = len(self._result_cache)
- 75 while pos < upper:
- 76 yield self._result_cache[pos]
- 77 pos = pos + 1
- 78 if not self._has_more:
- 79 raise StopIteration
- 80 if len(self._result_cache) <= pos:
- 81 ==> self._populate_cache()
- 82
- 83 def _populate_cache(self):
- 84 """
- 85 Populates the result cache with ``ITER_CHUNK_SIZE`` more entries
- 86 (until the cursor is exhausted).
- 87 """
- Variables:
- upper = 0
- self = .. queryset mid-iteration ..
- pos = 0
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/dereference.py (Line: 31)
- Function: __call__
- 24 """
- 25 if items is None or isinstance(items, basestring):
- 26 return items
- 27
- 28 # cheapest way to convert a queryset to a list
- 29 # list(queryset) uses a count() query to determine length
- 30 if isinstance(items, QuerySet):
- 31 ==> items = [i for i in items]
- 32
- 33 self.max_depth = max_depth
- 34 doc_type = None
- 35
- 36 if instance and isinstance(instance, (Document, EmbeddedDocument,
- 37 TopLevelDocumentMetaclass)):
- Variables:
- instance = None
- self = <mongoengine.dereference.DeReference object at 0x811a98410>
- items = .. queryset mid-iteration ..
- name = None
- max_depth = 2
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 565)
- Function: select_related
- 558 the number queries to mongodb.
- 559
- 560 .. versionadded:: 0.5
- 561 """
- 562 # Make select related work the same for querysets
- 563 max_depth += 1
- 564 queryset = self.clone()
- 565 ==> return queryset._dereference(queryset, max_depth=max_depth)
- 566
- 567 def limit(self, n):
- 568 """Limit the number of returned documents to `n`. This may also be
- 569 achieved using array-slicing syntax (e.g. ``User.objects[:5]``).
- 570
- 571 :param n: the maximum number of objects to return
- Variables:
- self = repr() failed
- queryset = .. queryset mid-iteration ..
- max_depth = 2
- ------------------------------------------------------------------------
- File: /opt/noc/ip/apps/reporthistory/views.py (Line: 58)
- Function: get_data
- 51 scope += ["ip_prefix"]
- 52 if include_addresses:
- 53 scope += ["ip_address"]
- 54 last = None
- 55 r = []
- 56 for l in AuditTrail.objects.filter(timestamp__gte=dt,
- 57 db_table__in=scope)\
- 58 ==> .order_by("-timestamp")\
- 59 .select_related():
- 60 d = l.timestamp.date()
- 61 if d != last:
- 62 last = d
- 63 r += [SectionRow(d.isoformat())]
- 64 r += [(
- Variables:
- last = None
- self =
- <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
- include_addresses = False
- days = 3
- include_prefixes = True
- r = []
- kwargs = {}
- scope = ['ip_prefix']
- dt = datetime.date(2014, 11, 21)
- ------------------------------------------------------------------------
- File: /opt/noc/lib/app/simplereport.py (Line: 635)
- Function: report_html
- 628 """
- 629 return Report()
- 630
- 631 def report_html(self, **kwargs):
- 632 """
- 633 Render HTML
- 634 """
- 635 ==> return self.get_data(**kwargs).to_html()
- 636
- 637 def report_csv(self, **kwargs):
- 638 """
- 639 Render CSV
- 640 """
- 641 return self.get_data(**kwargs).to_csv()
- Variables:
- self =
- <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
- kwargs = {'include_prefixes': True, 'include_addresses': False, 'days': 3}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/app/reportapplication.py (Line: 81)
- Function: view_report
- 74 else:
- 75 form = form_class()
- 76 # No POST or error - render form
- 77 if not query:
- 78 return self.render(request, "report_form.html",
- 79 form=form, app=self, is_report=True)
- 80 # Build result
- 81 ==> rdata = getattr(self, "report_%s" % format)(**query)
- 82 # Render result
- 83 if format == "html":
- 84 return self.render(request, "report.html",
- 85 data=rdata, app=self, is_report=True)
- 86 else:
- 87 return self.render_response(rdata,
- Variables:
- form = <noc.ip.apps.reporthistory.views.form object at 0x8121f2090>
- format = 'html'
- self =
- <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
- request =
- <WSGIRequest
- path:/ip/reporthistory/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {u'include_prefixes': [u'on'], u'days': [u'3']}>,
- COOKIES:{'csrftoken': 'Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc',
- 'sessionid': 'ca1c0d94710bc658970c38994269a845'},
- META:{'CONTENT_LENGTH': '26',
- 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc; sessionid=ca1c0d94710bc658970c38994269a845',
- 'HTTP_HOST': 'noc',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0',
- 'HTTP_X_SCHEME': 'http',
- 'PATH_INFO': u'/ip/reporthistory/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'POST',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': 'noc',
- 'SERVER_PORT': '80',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x808f8bb70>,
- 'wsgi.input': <_io.BytesIO object at 0x812184170>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- form_class = <class 'noc.ip.apps.reporthistory.views.form'>
- query = {'include_prefixes': True, 'include_addresses': False, 'days': 3}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/app/site.py (Line: 248)
- Function: inner
- 241 a = dict((k, v[0] if len(v) == 1 else v)
- 242 for k, v in request.GET.lists())
- 243 app_logger.debug("API %s %s %s",
- 244 request.method, request.path, a)
- 245 # Call handler
- 246 v.__dict__["hits_metric"] += 1
- 247 with v.__dict__["time_metric"].timer():
- 248 ==> r = v(request, *args, **kwargs)
- 249 # Dump SQL statements
- 250 if self.log_sql_statements:
- 251 from django.db import connections
- 252 tsc = 0
- 253 sc = defaultdict(int)
- 254 for conn in connections.all():
- Variables:
- args = ()
- view_map =
- {'DELETE': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
- 'GET': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
- 'POST': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>,
- 'PUT': <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>}
- Form = <class 'django.forms.forms.Form'>
- PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
- DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
- self = <noc.lib.app.site.Site object at 0x80d55f550>
- v =
- <bound method ReportHistoryApplication.view_report of <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>>
- request =
- <WSGIRequest
- path:/ip/reporthistory/,
- GET:<QueryDict: {}>,
- POST:<QueryDict: {u'include_prefixes': [u'on'], u'days': [u'3']}>,
- COOKIES:{'csrftoken': 'Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc',
- 'sessionid': 'ca1c0d94710bc658970c38994269a845'},
- META:{'CONTENT_LENGTH': '26',
- 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
- 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
- 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
- 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
- 'HTTP_CONNECTION': 'close',
- 'HTTP_COOKIE': 'csrftoken=Heph8r5sa8IhdtXSyhWHNNuLqfZsGqOc; sessionid=ca1c0d94710bc658970c38994269a845',
- 'HTTP_HOST': 'noc',
- 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0',
- 'HTTP_X_SCHEME': 'http',
- 'PATH_INFO': u'/ip/reporthistory/',
- 'QUERY_STRING': '',
- 'REMOTE_ADDR': '127.0.0.1',
- 'REQUEST_METHOD': 'POST',
- 'SCRIPT_NAME': u'',
- 'SERVER_NAME': 'noc',
- 'SERVER_PORT': '80',
- 'SERVER_PROTOCOL': 'HTTP/1.0',
- 'wsgi.errors': <open file '/dev/null', mode 'a+' at 0x808f8bb70>,
- 'wsgi.input': <_io.BytesIO object at 0x812184170>,
- 'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
- 'wsgi.url_scheme': 'http',
- 'wsgi.version': (1, 0)}>
- app_logger = <logging.Logger object at 0x811483d90>
- InterfaceTypeError = <class 'noc.sa.interfaces.base.InterfaceTypeError'>
- to_log_api_call = False
- kwargs = {}
- nq = <function nq at 0x81232fc80>
- app =
- <noc.ip.apps.reporthistory.views.ReportHistoryApplication object at 0x811483d50>
- ------------------------------------------------------------------------
- END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement