Created
April 21, 2014 15:12
-
-
Save morenopc/11145478 to your computer and use it in GitHub Desktop.
VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onlinebr-project$ bin/django shell | |
File not found: /etc/onlinebr/config.cfg | |
Execute: $ fab sendsmsconfig : url = http://send.sms.com, user = test, password = S3cr3t3 | |
INFO 2014-04-21 17:10:21,531 base 21357 140377689782016 Raven is not configured (logging is disabled). Please see the documentation for more information. | |
Python 2.7.3 (default, Feb 27 2014, 19:58:35) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 0.12 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object', use 'object??' for extra details. | |
In [1]: from tastypie.models import ApiKey | |
In [2]: from accounts.models import BRUser | |
In [3]: from django.test.client import Client | |
In [4]: | |
In [4]: userA1 = BRUser.objects.get(username='[email protected]') | |
In [5]: c = Client() | |
In [6]: response = c.get('/api/v1/room/', data={'username': userA1.username, 'api_key': userA1.api_key.key}) | |
UserWarning: 'override_urls' is a deprecated method & will be removed by v1.0.0. Please use ``prepend_urls`` instead. [api.py:82] | |
ERROR 2014-04-21 17:10:58,353 base 21357 140377689782016 Internal Server Error: /api/v1/room/ | |
Traceback (most recent call last): | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/core/handlers/base.py", line 188, in get_response | |
response = middleware_method(request, response) | |
File "/vagrant/sherpany/onlinebr/eggs/django_tracking2-0.1.9-py2.7.egg/tracking/middleware.py", line 69, in process_response | |
visitor.save() | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save | |
self.save_base(using=using, force_insert=force_insert, force_update=force_update) | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/db/models/base.py", line 565, in save_base | |
created=(not record_exists), raw=raw, using=using) | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send | |
response = receiver(signal=self, sender=sender, **named) | |
File "/vagrant/sherpany/onlinebr/src/statistic/models.py", line 516, in visitor_statistic_handler | |
user_statistic=user_statistic, visitor=visitor) | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/db/models/manager.py", line 134, in get_or_create | |
return self.get_query_set().get_or_create(**kwargs) | |
File "/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/db/models/query.py", line 452, in get_or_create | |
obj.save(force_insert=True, using=self.db) | |
File "/vagrant/sherpany/onlinebr/src/statistic/models.py", line 332, in save | |
user_agent = user_agent_parser.Parse(self.visitor.user_agent) | |
File "/vagrant/sherpany/onlinebr/eggs/ua_parser-0.3.5-py2.7.egg/ua_parser/user_agent_parser.py", line 185, in Parse | |
'user_agent': ParseUserAgent(user_agent_string, **jsParseBits), | |
File "/vagrant/sherpany/onlinebr/eggs/ua_parser-0.3.5-py2.7.egg/ua_parser/user_agent_parser.py", line 210, in ParseUserAgent | |
family, v1, v2, v3 = uaParser.Parse(user_agent_string) | |
File "/vagrant/sherpany/onlinebr/eggs/ua_parser-0.3.5-py2.7.egg/ua_parser/user_agent_parser.py", line 63, in Parse | |
match = self.user_agent_re.search(user_agent_string) | |
TypeError: expected string or buffer | |
ERROR: An unexpected error occurred while tokenizing input | |
The following traceback may be corrupted or invalid | |
The error message is: ('EOF in multi-line statement', (3, 0)) | |
--------------------------------------------------------------------------- | |
VariableDoesNotExist Traceback (most recent call last) | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/core/management/commands/shell.pyc in <module>() | |
----> 1 response = c.get('/api/v1/room/', data={'username': userA1.username, 'api_key': userA1.api_key.key}) | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/test/client.pyc in get(self, path, data, follow, **extra) | |
437 Requests a response from the server using GET. | |
438 """ | |
--> 439 response = super(Client, self).get(path, data=data, **extra) | |
440 if follow: | |
441 response = self._handle_redirects(response, **extra) | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/test/client.pyc in get(self, path, data, **extra) | |
242 } | |
243 r.update(extra) | |
--> 244 return self.request(**r) | |
245 | |
246 def post(self, path, data={}, content_type=MULTIPART_CONTENT, | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/test/client.pyc in request(self, **request) | |
379 | |
380 try: | |
--> 381 response = self.handler(environ) | |
382 except TemplateDoesNotExist, e: | |
383 # If the view raises an exception, Django will attempt to show | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/test/client.pyc in __call__(self, environ) | |
82 # admin views. | |
83 request._dont_enforce_csrf_checks = not self.enforce_csrf_checks | |
---> 84 response = self.get_response(request) | |
85 finally: | |
86 signals.request_finished.disconnect(close_connection) | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/core/handlers/base.pyc in get_response(self, request) | |
190 except: # Any exception should be gathered and handled | |
191 signals.got_request_exception.send(sender=self.__class__, request=request) | |
--> 192 response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) | |
193 | |
194 return response | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/core/handlers/base.pyc in handle_uncaught_exception(self, request, resolver, exc_info) | |
226 # Return an HttpResponse that displays a friendly error message. | |
227 callback, param_dict = resolver.resolve500() | |
--> 228 return callback(request, **param_dict) | |
229 | |
230 def apply_response_fixes(self, request, response): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/utils/decorators.pyc in _wrapped_view(request, *args, **kwargs) | |
89 return result | |
90 try: | |
---> 91 response = view_func(request, *args, **kwargs) | |
92 except Exception, e: | |
93 if hasattr(middleware, 'process_exception'): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/views/defaults.pyc in server_error(request, template_name) | |
31 """ | |
32 t = loader.get_template(template_name) # You need to create a 500.html template. | |
---> 33 return http.HttpResponseServerError(t.render(Context({}))) | |
34 | |
35 | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
138 context.render_context.push() | |
139 try: | |
--> 140 return self._render(context) | |
141 finally: | |
142 context.render_context.pop() | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in _render(self, context) | |
132 | |
133 def _render(self, context): | |
--> 134 return self.nodelist.render(context) | |
135 | |
136 def render(self, context): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
821 for node in self: | |
822 if isinstance(node, Node): | |
--> 823 bit = self.render_node(node, context) | |
824 else: | |
825 bit = node | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render_node(self, node, context) | |
835 | |
836 def render_node(self, node, context): | |
--> 837 return node.render(context) | |
838 | |
839 class TextNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/loader_tags.pyc in render(self, context) | |
121 # Call Template._render explicitly so the parser context stays | |
122 # the same. | |
--> 123 return compiled_parent._render(context) | |
124 | |
125 class BaseIncludeNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in _render(self, context) | |
132 | |
133 def _render(self, context): | |
--> 134 return self.nodelist.render(context) | |
135 | |
136 def render(self, context): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
821 for node in self: | |
822 if isinstance(node, Node): | |
--> 823 bit = self.render_node(node, context) | |
824 else: | |
825 bit = node | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render_node(self, node, context) | |
835 | |
836 def render_node(self, node, context): | |
--> 837 return node.render(context) | |
838 | |
839 class TextNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/loader_tags.pyc in render(self, context) | |
121 # Call Template._render explicitly so the parser context stays | |
122 # the same. | |
--> 123 return compiled_parent._render(context) | |
124 | |
125 class BaseIncludeNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in _render(self, context) | |
132 | |
133 def _render(self, context): | |
--> 134 return self.nodelist.render(context) | |
135 | |
136 def render(self, context): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
821 for node in self: | |
822 if isinstance(node, Node): | |
--> 823 bit = self.render_node(node, context) | |
824 else: | |
825 bit = node | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render_node(self, node, context) | |
835 | |
836 def render_node(self, node, context): | |
--> 837 return node.render(context) | |
838 | |
839 class TextNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/defaulttags.pyc in render(self, context) | |
368 def render(self, context): | |
369 from django.utils.html import strip_spaces_between_tags | |
--> 370 return strip_spaces_between_tags(self.nodelist.render(context).strip()) | |
371 | |
372 class TemplateTagNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
821 for node in self: | |
822 if isinstance(node, Node): | |
--> 823 bit = self.render_node(node, context) | |
824 else: | |
825 bit = node | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render_node(self, node, context) | |
835 | |
836 def render_node(self, node, context): | |
--> 837 return node.render(context) | |
838 | |
839 class TextNode(Node): | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in render(self, context) | |
872 def render(self, context): | |
873 try: | |
--> 874 output = self.filter_expression.resolve(context) | |
875 except UnicodeDecodeError: | |
876 # Unicode conversion can fail sometimes for reasons out of our | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in resolve(self, context, ignore_failures) | |
591 arg_vals.append(mark_safe(arg)) | |
592 else: | |
--> 593 arg_vals.append(arg.resolve(context)) | |
594 if getattr(func, 'expects_localtime', False): | |
595 obj = localtime(obj, context.use_tz) | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in resolve(self, context) | |
719 if self.lookups is not None: | |
720 # We're dealing with a variable that needs to be resolved | |
--> 721 value = self._resolve_lookup(context) | |
722 else: | |
723 # We're dealing with a literal, so it's already been "resolved" | |
/vagrant/sherpany/onlinebr/venv/lib/python2.7/site-packages/django/template/base.pyc in _resolve_lookup(self, context) | |
762 raise VariableDoesNotExist("Failed lookup for key " | |
763 "[%s] in %r", | |
--> 764 (bit, current)) # missing attribute | |
765 if callable(current): | |
766 if getattr(current, 'do_not_call_in_templates', False): | |
VariableDoesNotExist: Failed lookup for key [request] in u'[{}]' | |
In [7]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment