i've fired project clean on new machine , when entering admin got following error, indicates syntax error in forms.py ( believe admin's forms). seen before ? :
environment: request method: request url: http://djtest.test.rte.ie/access/admin/ django version: 1.1.2 python version: 2.4.3 installed applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'tagging', 'rte_utils.filetransfers', 'rte_utils.syncr', 'rte_utils.twitter', 'rte_utils.youtube', 'rte_utils.flickr', 'rte_site', 'rte_site.static_pages', 'rte_site.artifact', 'rte_site.candid', 'rte_site.events', 'rte_site.playforward', 'rte_site.setspy', 'debug_toolbar'] installed middleware: ('django.middleware.cache.updatecachemiddleware', 'django.contrib.sessions.middleware.sessionmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.middleware.common.commonmiddleware', 'rte_site.middleware.flatpagefallbackmiddleware', 'django.middleware.cache.fetchfromcachemiddleware') template error: in template /usr/lib/python2.4/site-packages/django/contrib/admin/templates/admin/base.html, error @ line 30 caught syntaxerror while rendering: invalid syntax (forms.py, line 227) 20 : 21 : 22 : 23 : {% block branding %}{% endblock %} 24 : 25 : {% if user.is_authenticated , user.is_staff %} 26 : 27 : {% trans 'welcome,' %} 28 : {% filter force_escape %}{% firstof user.first_name user.username %}{% endfilter %}. 29 : {% block userlinks %} 30 : {% url django-admindocs-docroot docsroot %} 31 : {% if docsroot %} 32 : {% trans 'documentation' %} / 33 : {% endif %} 34 : {% url admin:password_change password_change_url %} 35 : {% if password_change_url %} 36 : 37 : {% else %} 38 : 39 : {% endif %} 40 : {% trans 'change password' %} / traceback: file "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 99. response = callback(request, callback_args, **callback_kwargs) file "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py" in root 480. return self.index(request) file "/usr/lib/python2.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 44. response = view_func(request, args, kwargs) file "/usr/lib/python2.4/site-packages/django/contrib/admin/sites.py" in index 377. context_instance=context_instance file "/usr/lib/python2.4/site-packages/django/shortcuts/init.py" in render_to_response 20. return httpresponse(loader.render_to_string(*args, kwargs), *httpresponse_kwargs) file "/usr/lib/python2.4/site-packages/django/template/loader.py" in render_to_string 108. return t.render(context_instance) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 165. return self.nodelist.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/loader_tags.py" in render 97. return compiled_parent.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 165. return self.nodelist.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/loader_tags.py" in render 97. return compiled_parent.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 165. return self.nodelist.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/defaulttags.py" in render 240. return self.nodelist_true.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/defaulttags.py" in render 250. return self.nodelist_true.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/loader_tags.py" in render 24. result = self.nodelist.render(context) file "/usr/lib/python2.4/site-packages/django/template/init.py" in render 784. bits.append(self.render_node(node, context)) file "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) file "/usr/lib/python2.4/site-packages/django/template/defaulttags.py" in render 367. url = reverse(self.view_name, args=args, kwargs=kwargs, current_app=context.current_app) file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in reverse 357. return iri_to_uri(u'%s%s' % (prefix, resolver.reverse(view, file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in reverse 279. possibilities = self.reverse_dict.getlist(lookup_view) file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in get_reverse_dict 199. self.populate() file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in populate 179. name in pattern.reverse_dict: file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in get_reverse_dict 199. self.populate() file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in populate 191. lookups.appendlist(pattern.callback, (bits, p_pattern)) file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in get_callback 135. self.callback = get_callable(self._callback_str) file "/usr/lib/python2.4/site-packages/django/utils/functional.py" in wrapper 130. result = func(args) file "/usr/lib/python2.4/site-packages/django/core/urlresolvers.py" in get_callable 62. lookup_view = getattr(import_module(mod_name), func_name) file "/usr/lib/python2.4/site-packages/django/utils/importlib.py" in import_module 35. import(name) file "/usr/lib/python2.4/site-packages/allaccess/rte_site/management/views.py" in ? 38. forms import adminform exception type: templatesyntaxerror @ /admin/ exception value: caught syntaxerror while rendering: invalid syntax (forms.py, line 227)
if forms.py file mentioned in traceback 1 think is, line causing problems:
def __init__(self, *args, **kwargs): self.father = kwargs.pop('parent', none) if kwargs else none
anything wrong here python 2.4 ?
no, error in "/usr/lib/python2.4/site-packages/allaccess/rte_site/management/views.py", package have installed yourself.
the reason comes because django needs import views in order reverse-lookup urls, , importing view gives syntax error.
edited after post update yes, ternary if syntax - y if x else z
- python 2.5 , above. lower versions, you'd need rewrite standard if
statement block.
Comments
Post a Comment