示例#1
0
 def get(cls, config, entry_points):
     """Return an instance of the SpamFilter impl specified in ``config``.
     """
     method = config.get('spam.method')
     if not method:
         return cls(config)
     result = entry_points[method]
     filter_obj = result(config)
     filter_obj.check = exceptionless(False, log=log)(filter_obj.check)
     return filter_obj
示例#2
0
    def command(self):
        # If this script creates a new BlogPost, it will create an
        # activitystream activity for that post. During the saving of the
        # activity, User.url() will be called. This method defers to an
        # AuthenticationProvider, which depends on a request being setup in
        # the current thread. So, we set one up here.
        import pylons, webob
        pylons.request._push_object(webob.Request.blank('/'))

        self.basic_setup()
        self.process_feed = exceptionless(None, log=allura_base.log)(self.process_feed)
        self.process_entry = exceptionless(None, log=allura_base.log)(self.process_entry)

        user = M.User.query.get(username=self.options.username)
        c.user = user

        self.prepare_feeds()
        for appid in self.feed_dict:
            for feed_url in self.feed_dict[appid]:
                self.process_feed(appid, feed_url)