def authenticate(self, assertion=None, audience=None, authenticated_email=None): if authenticated_email: users = User.objects.filter(email=authenticated_email) if len(users) > 1: log.warn('%d users with email address %s.' % ( len(users), authenticated_email)) return None if len(users) == 1: return users[0] return super(MozilliansBrowserID, self).authenticate( assertion=assertion, audience=audience)
def authenticate(self, assertion=None, audience=None, authenticated_email=None): if authenticated_email: users = User.objects.filter(email=authenticated_email) if len(users) > 1: log.warn('%d users with email address %s.' % (len(users), authenticated_email)) return None if len(users) == 1: return users[0] return super(MozilliansBrowserID, self).authenticate(assertion=assertion, audience=audience)
def get_result_set(self, term, result, offset, limit): # Remove transformations for now so we can pull them in later. qs = Addon.objects.all() transforms = qs._transform_fns qs._transform_fns = [] # Return results as a list of add-ons. addon_ids = [m['attrs']['addon_id'] for m in result['matches']] addons = [] for addon_id in addon_ids: try: addons.append(qs.get(pk=addon_id)) except Addon.DoesNotExist: # pragma: no cover log.warn(u'%d: Result for %s refers to non-existent ' 'addon: %d' % (self.id, term, addon_id)) # Do the transforms now that we have all the add-ons. for fn in transforms: fn(addons) return ResultSet(addons, min(self.total_found, SPHINX_HARD_LIMIT), offset)