Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
 #  if user and askbot_settings.GROUP_ENABLED: (askbot/models/question.py line 745)
 #  this line throws 'AnonymousUser' object has no attribute 'get_groups' except for AnonymousUser. See fix below.

    if user.is_authenticated() and askbot_settings.GROUPS_ENABLED:
        #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()
 #  if user and askbot_settings.GROUP_ENABLED: (askbot/models/question.py line 745)
 #  this line throws 'AnonymousUser' object has no attribute 'get_groups' except exception for AnonymousUser. See fix below.

    if user.is_authenticated() and askbot_settings.GROUPS_ENABLED:
        #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()
 #  if user and askbot_settings.GROUP_ENABLED: (askbot/models/question.py 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() and askbot_settings.GROUPS_ENABLED:
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()