File '/var/local/allura/ForgeActivity/forgeactivity/main.py', line 120 in feed 'title': 'Activity for %s' % data['followee'].shortname, AttributeError: 'User' object has no attribute 'shortname'
allura:cj/7085
Looks good, but the attribute checking is ugly. How about this:
diff --git Allura/allura/model/project.py Allura/allura/model/project.py index f971293..eaec993 100644 --- Allura/allura/model/project.py +++ Allura/allura/model/project.py @@ -228,7 +228,7 @@ class __mongometa__: @property def activity_name(self): - return self.shortname + return self.name @property def permissions(self): diff --git ForgeActivity/forgeactivity/main.py ForgeActivity/forgeactivity/main.py index 752d279..8ec3a78 100644 --- ForgeActivity/forgeactivity/main.py +++ ForgeActivity/forgeactivity/main.py @@ -131,10 +131,7 @@ def feed(self, **kw): data = self._get_activities_data(**kw) response.headers['Content-Type'] = '' response.content_type = 'application/xml' - if hasattr(data['followee'], 'display_name'): - followee = data['followee'].display_name - else: - followee = data['followee'].name + followee = data['followee'].activity_name d = { 'title': 'Activity for %s' % followee, 'link': h.absurl(self.app.url),
Agreed, that is much better. I rebased the branch and amended the change to the commit.
Log in to post a comment.
allura:cj/7085
Looks good, but the attribute checking is ugly. How about this:
Agreed, that is much better. I rebased the branch and amended the change to the commit.
allura:cj/7085