Beispiel #1
0
 def setUp(self):
     super(MediaTest, self).setUp()
     setup_global_translator(registry=self.paste_registry)
     self.init_flowplayer()
     self.media = Media.example()
     self.encoding_event = self.create_spy_on_event(
         events.Media.encoding_done)
Beispiel #2
0
    def __before__(self, *args, **kwargs):
        """This method is called before your action is.

        It should be used for setting up variables/objects, restricting access
        to other actions, or other tasks which should be executed before the
        action is called.

        NOTE: If this method is wrapped in an ActionProtector, all methods of
              the class will be protected it. See :meth:`__init__`.
        """
        registry = request.environ['paste.registry']
        setup_global_translator(registry=registry)
        response.scripts = Scripts()
        response.stylesheets = Stylesheets()
        response.feed_links = []
        response.facebook = None
        response.warnings = []
        request.perm = request.environ['mediadrop.perm']

        action_method = getattr(self, kwargs['action'], None)
        # The expose decorator sets the exposed attribute on controller
        # actions. If the method does not exist or is not exposed, raise
        # an HTTPNotFound exception.
        if not getattr(action_method, 'exposed', False):
            abort(status_code=404)
Beispiel #3
0
    def __before__(self, *args, **kwargs):
        """This method is called before your action is.

        It should be used for setting up variables/objects, restricting access
        to other actions, or other tasks which should be executed before the
        action is called.

        NOTE: If this method is wrapped in an ActionProtector, all methods of
              the class will be protected it. See :meth:`__init__`.
        """
        registry = request.environ['paste.registry']
        setup_global_translator(registry=registry)
        response.scripts = Scripts()
        response.stylesheets = StyleSheets()
        response.feed_links = []
        response.facebook = None
        response.warnings = []
        request.perm = request.environ['mediadrop.perm']

        action_method = getattr(self, kwargs['action'], None)
        # The expose decorator sets the exposed attribute on controller
        # actions. If the method does not exist or is not exposed, raise
        # an HTTPNotFound exception.
        if not getattr(action_method, 'exposed', False):
            abort(status_code=404)
Beispiel #4
0
 def setUp(self):
     super(MediaStatusUpdatesTypeTest, self).setUp()
     # prevent warning about missing handlers for logger
     # "mediadrop.model.players" ("fetch_enabled_players()")
     self.init_flowplayer()
     # required because "media.update_status()" will query
     # "registered_media_types()" which in turn calls "register_default_types()"
     # and then we need a translator (e.g. "_('Video')").
     paste_registry = self.pylons_config['paste.registry']
     setup_global_translator(registry=paste_registry)
     self.media = Media.example()
 def setUp(self):
     super(MediaStatusUpdatesTypeTest, self).setUp()
     # prevent warning about missing handlers for logger 
     # "mediadrop.model.players" ("fetch_enabled_players()")
     self.init_flowplayer()
     # required because "media.update_status()" will query
     # "registered_media_types()" which in turn calls "register_default_types()"
     # and then we need a translator (e.g. "_('Video')").
     paste_registry = self.pylons_config['paste.registry']
     setup_global_translator(registry=paste_registry)
     self.media = Media.example()
Beispiel #6
0
def init_mediadrop(config_filename, here_dir=None, disable_logging=False):
    if not os.path.exists(config_filename):
        raise IOError('Config file %r does not exist.' % config_filename)
    if here_dir is None:
        here_dir = os.getcwd()
    if not disable_logging:
        logging_config.fileConfig(config_filename)

    conf = appconfig('config:%s' % config_filename, relative_to=here_dir)
    pylons_config = load_environment(conf.global_conf, conf.local_conf)
    paste_registry = Registry()
    paste_registry.prepare()
    pylons_config['paste.registry'] = paste_registry
    
    app_globals = pylons_config['pylons.app_globals']
    register_instance(paste_registry, 'app_globals', app_globals)
    register_instance(paste_registry, 'config', pylons_config)
    fake_request(pylons_config, registry=paste_registry)
    setup_global_translator(registry=paste_registry)
 def setUp(self):
     super(YoutubeClientTest, self).setUp()
     # error messages need a registered translator
     paste_registry = self.pylons_config['paste.registry']
     setup_global_translator(registry=paste_registry)
Beispiel #8
0
 def setUp(self):
     super(MediaTest, self).setUp()
     setup_global_translator(registry=self.paste_registry)
     self.init_flowplayer()
     self.media = Media.example()
     self.encoding_event = self.create_spy_on_event(events.Media.encoding_done)