Ask Your Question

'AnonymousUser' object has no attribute 'get_groups'

asked 2014-11-22 00:31:06 -0500

johnli's avatar

After enable user group, for anonymous user, it throws error below. Any idea?

askbot/models/ in get_latest_revision

posts_filter['groups__in'] = user.get_groups()

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-23 21:40:05 -0500

johnli's avatar

updated 2014-11-29 16:14:35 -0500

 #  if user and askbot_settings.GROUP_ENABLED: (askbot/models/ line 745)
 #  this line throws 'AnonymousUser' object has no attribute 'get_groups' exception for AnonymousUser. See fix below.
 # user passed to this function could be actual user object, Anonymous user which doesnt have get_group(), or None

  if user and askbot_settings.GROUPS_ENABLED:
        if user.is_authenticated():
        #get post with groups shared with having at least 
        #one of the user groups
        #of those posts return the latest revision
            posts_filter['groups__in'] = user.get_groups()
edit flag offensive delete link more


Thanks, committed this change to the master branch.

Evgeny's avatar Evgeny  ( 2014-11-29 17:27:42 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-11-22 00:31:06 -0500

Seen: 530 times

Last updated: Nov 29 '14