def _decorate_with(fn):\r
def decorator(origin):\r
if not isinstance(origin, DecoratableObject):\r
- mod = inspect.getmodule(origin)\r
-\r
- name = origin.__name__\r
- origin = DecoratableObject(origin)\r
+ decoratable = DecoratableObject(origin)\r
+ else:\r
+ decoratable = origin\r
\r
- origin._decorate(fn, True, False)\r
- return origin\r
+ decoratable._decorate(fn, True, False)\r
+ return decoratable\r
return decorator\r
\r
\r
\r
def user_view(template, tab_name, tab_title, tab_description, private=False, tabbed=True, weight=500):\r
def decorator(fn):\r
- def decorated(request, id, slug=None):\r
+ def decorated(fn, request, id, slug=None):\r
user = get_object_or_404(User, id=id)\r
if private and not (user == request.user or request.user.is_superuser):\r
return HttpResponseUnauthorized(request)\r
tab_name, tab_title, tab_description,url_getter, private, weight\r
))\r
\r
- return decorated\r
-\r
+ return decorate.withfn(decorated)(fn)\r
return decorator\r
\r
\r
"awards": awards,\r
"total_awards" : len(awards),\r
}\r
-\r
+ \r
@user_view('users/recent.html', 'recent', _('recent activity'), _('recent user activity'))\r
def user_recent(request, user):\r
activities = user.actions.exclude(\r