コード例 #1
0
 def assembled(self):
   self.httpRequestMapper.registerLocationHandler(self)
   
   self.controller_names = []
   self.map = routes.Mapper(controller_scan=self.controller_names)
   self.map.minimization=True
   
   mod_names = ['Rambler', self.app.name] + [ext.name for ext in self.app.config.extensions]
   for mod_name in mod_names:
     mod_full_name = mod_name + ".web_controllers"
     for cls in load_classes(mod_full_name, component('WebController')):
       if hasattr(cls, "provides"):
         name = cls.provides
       else:
         name = cls.__name__
       self.compReg.addComponent(name, cls)
       controller_name = name.split('Controller',1)[0].lower()
       self.controller_names.append(controller_name)
      
     try:
       routes_mod_name = mod_full_name + '.routes'
       __import__(routes_mod_name,globals=globals(), locals=locals())
       routes_mod = sys.modules[routes_mod_name]
       routes_mod.add_routes(self.map)
     except(ImportError):
       pass
    def assembled(self):
        self.httpRequestMapper.registerLocationHandler(self)

        self.controller_names = []
        self.map = routes.Mapper(controller_scan=self.controller_names)
        self.map.minimization = True

        mod_names = ['Rambler', self.app.name
                     ] + [ext.name for ext in self.app.config.extensions]
        for mod_name in mod_names:
            mod_full_name = mod_name + ".web_controllers"
            for cls in load_classes(mod_full_name, component('WebController')):
                if hasattr(cls, "provides"):
                    name = cls.provides
                else:
                    name = cls.__name__
                self.compReg.addComponent(name, cls)
                controller_name = name.split('Controller', 1)[0].lower()
                self.controller_names.append(controller_name)

            try:
                routes_mod_name = mod_full_name + '.routes'
                __import__(routes_mod_name, globals=globals(), locals=locals())
                routes_mod = sys.modules[routes_mod_name]
                routes_mod.add_routes(self.map)
            except (ImportError):
                pass
コード例 #3
0
ファイル: URLProtocol.py プロジェクト: srobertson/rambler.net
 def assembled(cls):
   if cls is URLProtocol: # Don't run this method for components who inherit from URLProtocol
     mod_names = ['Rambler', cls.app.name] + [ext.name for ext in cls.app.config.extensions]
     classes = []
     for mod_name in mod_names:
       mod_full_name = mod_name + ".url_protocols"
       classes = list(load_classes(mod_full_name,cls))
       for protocol_class in classes:
         cls.componentRegistry.addComponent(
             protocol_class.__name__,
             protocol_class)
         cls.registerClass(protocol_class)
コード例 #4
0
ファイル: SessionRegistry.py プロジェクト: srobertson/rambler
 def assembled(self):
     mod_names = ["Rambler", self.app_name] + [ext.name for ext in self.app.config.extensions]
     for mod_name in mod_names:
         # note: I'm considering renaming sessions to controllers
         mod_full_name = mod_name + ".controllers"
         home_interface = remote_interface = None
         for cls in load_classes(mod_full_name, object):
             if hasattr(cls, "provides"):
                 name = cls.provides
             else:
                 name = cls.__name__
             self.addSession(name, cls, home_interface, remote_interface, [])
コード例 #5
0
ファイル: ServiceRegistry.py プロジェクト: srobertson/rambler
 def assembled(self):
   mod_names = ['Rambler', self.app_name] + [ext.name for ext in self.app.config.extensions]
   for mod_name in mod_names:
     #note: I'm considering renaming sessions to controllers
     mod_full_name = mod_name + ".services"
     home_interface = remote_interface = None
     for cls in load_classes(mod_full_name, object):
       if hasattr(cls, "provides"):
         name = cls.provides
       else:
         name = cls.__name__
       try:
         self.addService(name, cls(), None, [])
       except TypeError:
         # thrown if the constructor takes arguments, if so the class isn't
         # a service. We need a better way of identifying component types w/o
         # require an import of a class that makes a code dependency
         pass