示例#1
0
    def delete(self, hard=False):
        # Recursive import
        from olympia.users.tasks import delete_photo

        # Cache the values in case we do a hard delete and loose
        # reference to the user-id.
        picture_path = self.picture_path
        original_picture_path = self.picture_path_original

        if hard:
            super(UserProfile, self).delete()
        else:
            log.info(u'User (%s: <%s>) is being anonymized.' %
                     (self, self.email))
            self.email = None
            self.fxa_id = None
            self.display_name = None
            self.homepage = ''
            self.location = ''
            self.deleted = True
            self.picture_type = None
            self.auth_id = generate_auth_id()
            self.last_login_attempt = None
            self.last_login_attempt_ip = ''
            self.last_login_ip = ''
            self.anonymize_username()
            self.save()

        if storage.exists(picture_path):
            delete_photo.delay(picture_path)

        if storage.exists(original_picture_path):
            delete_photo.delay(original_picture_path)
示例#2
0
    def delete(self, hard=False):
        # Recursive import
        from olympia.users.tasks import delete_photo

        # Cache the values in case we do a hard delete and loose
        # reference to the user-id.
        picture_path = self.picture_path
        original_picture_path = self.picture_path_original

        if hard:
            super(UserProfile, self).delete()
        else:
            log.info(
                u'User (%s: <%s>) is being anonymized.' % (self, self.email))
            self.email = None
            self.fxa_id = None
            self.display_name = None
            self.homepage = ''
            self.location = ''
            self.deleted = True
            self.picture_type = None
            self.auth_id = generate_auth_id()
            self.last_login_attempt = None
            self.last_login_attempt_ip = ''
            self.last_login_ip = ''
            self.anonymize_username()
            self.save()

        if storage.exists(picture_path):
            delete_photo.delay(picture_path)

        if storage.exists(original_picture_path):
            delete_photo.delay(original_picture_path)
示例#3
0
    def delete_picture(self):
        """Delete picture of this user."""
        # Recursive import
        from olympia.users.tasks import delete_photo

        if storage.exists(self.picture_path):
            delete_photo.delay(self.picture_path)

        if storage.exists(self.picture_path_original):
            delete_photo.delay(self.picture_path_original)

        if self.picture_type:
            self.update(picture_type=None)
示例#4
0
    def delete_picture(self, picture_path=None, original_picture_path=None):
        """Delete picture of this user."""
        # Recursive import
        from olympia.users.tasks import delete_photo

        if picture_path is None:
            picture_path = self.picture_path
        if original_picture_path is None:
            original_picture_path = self.picture_path_original

        if storage.exists(picture_path):
            delete_photo.delay(picture_path)

        if storage.exists(original_picture_path):
            delete_photo.delay(original_picture_path)

        if self.picture_type:
            self.update(picture_type=None)
示例#5
0
文件: models.py 项目: diox/olympia
    def delete_picture(self, picture_path=None, original_picture_path=None):
        """Delete picture of this user."""
        # Recursive import
        from olympia.users.tasks import delete_photo

        if picture_path is None:
            picture_path = self.picture_path
        if original_picture_path is None:
            original_picture_path = self.picture_path_original

        if storage.exists(picture_path):
            delete_photo.delay(picture_path)

        if storage.exists(original_picture_path):
            delete_photo.delay(original_picture_path)

        if self.picture_type:
            self.update(picture_type=None)