Changes between Version 3 and Version 4 of Ticket #14515


Ignore:
Timestamp:
Dec 30, 2010, 9:17:32 AM (14 years ago)
Author:
Russell Keith-Magee
Comment:

Removed references to a pastebin. Trac provides perfectly adequate source code quoting tools, and has no risk of expiring, getting deleted etc.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14515

    • Property Milestone 1.3
    • Property Triage Stage UnreviewedAccepted
  • Ticket #14515 – Description

    v3 v4  
    1 This will work during pickle.dumps: http://paste.pocoo.org/show/278047/ but will fail when I run loads.
     1This will work during pickle.dumps:
     2{{{
     3            pagelist = Page.objects.all().select_related('last_rev')\
     4                .order_by('name').values_list('name', 'last_rev__deleted',
     5                    'last_rev__id', 'last_rev__attachment__id')
     6            # force a list, can't pickle ValueQueryset that way
     7            pagelist = list(pagelist)
     8            request_cache.set(key, pagelist, 10000)
     9}}}
    210
    3  The reason is that {{{ __getstate__ }}} of {{{ ValueQueryset }}} puts (in this case) {{{ ['name', 'deleted', 'id', 'id'] }}} into {{{  obj_dict['search_fields'] }}} (http://code.djangoproject.com/browser/django/trunk/django/db/models/sql/query.py#L176); during loads it won't find Page.deleted etc… (full traceback: http://paste.pocoo.org/show/278050/)
     11but will fail when I run loads.
     12
     13The reason is that {{{ __getstate__ }}} of {{{ ValueQueryset }}} puts (in this case) {{{ ['name', 'deleted', 'id', 'id'] }}} into {{{  obj_dict['search_fields'] }}} (http://code.djangoproject.com/browser/django/trunk/django/db/models/sql/query.py#L176); during loads it won't find Page.deleted etc… Full traceback:
     14{{{
     15Traceback (most recent call last):
     16  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/application.py", line 52, in __call__
     17    return self.app(environ, start_response)
     18  File "/home/florian/.virtualenvs/inyoka/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/core/handlers/wsgi.py", line 241, in __call__
     19    response = self.get_response(request)
     20  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/application.py", line 88, in get_response
     21    return callback(request, *args, **kwargs)
     22  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/views.py", line 60, in show_page
     23    return PAGE_ACTIONS[action or 'show'](request, normalized_name)
     24  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/acl.py", line 217, in oncall
     25    return f(request, name)
     26  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/utils/http.py", line 40, in proxy
     27    rv = f(request, *args, **kwargs)
     28  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/actions.py", line 99, in do_show
     29    return do_missing_page(request, name)
     30  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/utils/http.py", line 40, in proxy
     31    rv = f(request, *args, **kwargs)
     32  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/actions.py", line 199, in do_missing_page
     33    } for x in sorted(Page.objects.get_similar(name))],
     34  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/models.py", line 346, in get_similar
     35    self._get_object_list(False) if not x[1]], n)]
     36  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/wiki/models.py", line 200, in _get_object_list
     37    pagelist = request_cache.get(key)
     38  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/utils/cache.py", line 68, in get
     39    val = self.real_cache.get(key)
     40  File "/home/florian/.virtualenvs/inyoka/inyoka/inyoka/utils/cache.py", line 118, in get
     41    self.cache.get(key))
     42  File "/home/florian/.virtualenvs/inyoka/lib/python2.6/site-packages/Werkzeug-0.6.2-py2.6.egg/werkzeug/contrib/cache.py", line 229, in get
     43    return loads(value)
     44  File "/home/florian/.virtualenvs/inyoka/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/db/models/sql/query.py", line 200, in __setstate__
     45    for name in obj_dict['select_fields']
     46  File "/home/florian/.virtualenvs/inyoka/lib/python2.6/site-packages/Django-1.2.3-py2.6.egg/django/db/models/options.py", line 273, in get_field
     47    raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, name))
     48FieldDoesNotExist: Page has no field named 'deleted'
     49}}}
Back to Top