No lazy_* needed here; Add ReallyLazyProxy.__repr__.
One should use lazy_* only if you have a good reason. This one found by our unit tests! For example add_message adds the message to the session, the session needs to be serialized (with json) and well, LazyProxy is not serializable. To aid in debugging, gave our ReallyLazyProxy a __repr__.
This commit is contained in:
parent
c47be4b8ba
commit
5ae0cbaa55
@ -29,7 +29,7 @@ from mediagoblin.decorators import (require_active_login, active_user_from_url,
|
|||||||
get_media_entry_by_id,
|
get_media_entry_by_id,
|
||||||
user_may_alter_collection, get_user_collection)
|
user_may_alter_collection, get_user_collection)
|
||||||
from mediagoblin.tools.response import render_to_response, redirect
|
from mediagoblin.tools.response import render_to_response, redirect
|
||||||
from mediagoblin.tools.translate import lazy_pass_to_ugettext as _
|
from mediagoblin.tools.translate import pass_to_ugettext as _
|
||||||
from mediagoblin.tools.text import (
|
from mediagoblin.tools.text import (
|
||||||
convert_to_tag_list_of_dicts, media_tags_as_string)
|
convert_to_tag_list_of_dicts, media_tags_as_string)
|
||||||
from mediagoblin.tools.url import slugify
|
from mediagoblin.tools.url import slugify
|
||||||
|
@ -50,6 +50,13 @@ class ReallyLazyProxy(LazyProxy):
|
|||||||
def value(self):
|
def value(self):
|
||||||
return self._func(*self._args, **self._kwargs)
|
return self._func(*self._args, **self._kwargs)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "<%s for %s(%r, %r)>" % (
|
||||||
|
self.__class__.__name__,
|
||||||
|
self._func,
|
||||||
|
self._args,
|
||||||
|
self._kwargs)
|
||||||
|
|
||||||
|
|
||||||
def locale_to_lower_upper(locale):
|
def locale_to_lower_upper(locale):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user