예제 #1
0
    def delete(self, delete_message=None):
        self.delete_message = delete_message
        self.delete_time = datetime.now(g.tz)
        self._deleted = True
        self._commit()

        # update caches
        Account._by_name(self.name, allow_deleted=True, _update=True)
        # we need to catch an exception here since it will have been
        # recently deleted
        try:
            Account._by_name(self.name, _update=True)
        except NotFound:
            pass

        # remove from friends lists
        q = Friend._query(Friend.c._thing2_id == self._id, Friend.c._name == "friend", eager_load=True)
        for f in q:
            f._thing1.remove_friend(f._thing2)

        q = Friend._query(Friend.c._thing2_id == self._id, Friend.c._name == "enemy", eager_load=True)
        for f in q:
            f._thing1.remove_enemy(f._thing2)

        # wipe out stored password data after a recovery period
        TryLater.schedule("account_deletion", self._id36, delay=timedelta(days=90))

        # Remove OAuth2Client developer permissions.  This will delete any
        # clients for which this account is the sole developer.
        from r2.models.token import OAuth2Client

        for client in OAuth2Client._by_developer(self):
            client.remove_developer(self)
예제 #2
0
def _check_edits(link):
    checking_edits = getattr(link, "dfp_checking_edits", False)

    if not checking_edits:
        TryLater.schedule("dfp_check_edits", link._fullname, timedelta(minutes=5))

        link.dfp_checking_edits = True
        link._commit()
예제 #3
0
def _check_edits(link):
    checking_edits = getattr(link, "dfp_checking_edits", False)

    if not checking_edits:
        TryLater.schedule("dfp_check_edits", link._fullname,
                          timedelta(minutes=5))

        link.dfp_checking_edits = True
        link._commit()
예제 #4
0
파일: trylater.py 프로젝트: AjaxGb/reddit
def run_trylater():
    our_hooks = (key[len(PREFIX):] for key in all_hooks().keys()
                 if key.startswith(PREFIX))
    with TryLater.multi_handle(our_hooks) as handleable:
        for system, data in handleable.iteritems():
            hook_name = "trylater.%s" % system
            g.log.info("Trying %s", system)

            get_hook(hook_name).call(data=data)

    amqp.worker.join()
예제 #5
0
def run_trylater():
    our_hooks = (key[len(PREFIX):] for key in all_hooks().keys()
                 if key.startswith(PREFIX))
    with TryLater.multi_handle(our_hooks) as handleable:
        for system, mature_items in handleable.iteritems():
            hook_name = "trylater.%s" % system
            g.log.info("Trying %s", system)

            get_hook(hook_name).call(mature_items=mature_items)

    amqp.worker.join()
예제 #6
0
파일: account.py 프로젝트: zeantsoi/reddit
    def delete(self, delete_message=None):
        self.delete_message = delete_message
        self.delete_time = datetime.now(g.tz)
        self._deleted = True
        self._commit()

        # update caches
        Account._by_name(self.name, allow_deleted=True, _update=True)
        # we need to catch an exception here since it will have been
        # recently deleted
        try:
            Account._by_name(self.name, _update=True)
        except NotFound:
            pass

        # Mark this account for immediate cleanup tasks
        amqp.add_item("account_deleted", self._fullname)

        # schedule further cleanup after a possible recovery period
        TryLater.schedule("account_deletion", self._id36, delay=timedelta(days=90))
예제 #7
0
    def delete(self, delete_message=None):
        self.delete_message = delete_message
        self.delete_time = datetime.now(g.tz)
        self._deleted = True
        self._commit()

        #update caches
        Account._by_name(self.name, allow_deleted=True, _update=True)
        #we need to catch an exception here since it will have been
        #recently deleted
        try:
            Account._by_name(self.name, _update=True)
        except NotFound:
            pass

        # Mark this account for scrubbing
        amqp.add_item('account_deleted', self._fullname)

        #remove from friends lists
        q = Friend._query(Friend.c._thing2_id == self._id,
                          Friend.c._name == 'friend',
                          eager_load=True)
        for f in q:
            f._thing1.remove_friend(f._thing2)

        q = Friend._query(Friend.c._thing2_id == self._id,
                          Friend.c._name == 'enemy',
                          eager_load=True)
        for f in q:
            f._thing1.remove_enemy(f._thing2)

        # wipe out stored password data after a recovery period
        TryLater.schedule("account_deletion",
                          self._id36,
                          delay=timedelta(days=90))

        # Remove OAuth2Client developer permissions.  This will delete any
        # clients for which this account is the sole developer.
        from r2.models.token import OAuth2Client
        for client in OAuth2Client._by_developer(self):
            client.remove_developer(self)
예제 #8
0
    def delete(self, delete_message=None):
        self.delete_message = delete_message
        self.delete_time = datetime.now(g.tz)
        self._deleted = True
        self._commit()

        #update caches
        Account._by_name(self.name, allow_deleted = True, _update = True)
        #we need to catch an exception here since it will have been
        #recently deleted
        try:
            Account._by_name(self.name, _update = True)
        except NotFound:
            pass

        # Mark this account for immediate cleanup tasks
        amqp.add_item('account_deleted', self._fullname)

        # schedule further cleanup after a possible recovery period
        TryLater.schedule("account_deletion", self._id36,
                          delay=timedelta(days=90))