#7085 error on activity rss feed for users

asf_release_1.2.0
closed
Cory Johns
General
2015-01-18
2014-01-24
Dave Brondsema
No
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'

Discussion

  • Dave Brondsema
    Dave Brondsema
    2014-01-24

    • Size: --> 1
     
  • Cory Johns
    Cory Johns
    2014-01-24

    • status: open --> in-progress
    • assigned_to: Cory Johns
     
  • Cory Johns
    Cory Johns
    2014-01-24

    • status: in-progress --> code-review
     
  • Cory Johns
    Cory Johns
    2014-01-24

    allura:cj/7085

     
  • Dave Brondsema
    Dave Brondsema
    2014-01-30

    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),
    
     
  • Cory Johns
    Cory Johns
    2014-02-03

    Agreed, that is much better. I rebased the branch and amended the change to the commit.

    allura:cj/7085

     
  • Dave Brondsema
    Dave Brondsema
    2014-02-04

    • status: code-review --> closed
    • QA: Dave Brondsema
     
  • Dave Brondsema
    Dave Brondsema
    2015-01-05

    • Milestone: unreleased --> asf_release_1.2.0