Пример #1
0
 def register(self, cls):
   instance = cls()
   pau.resolve(instance)
   self.controllers.append(instance)
   t_methods = inspect.getmembers(instance, predicate=lambda x: inspect.isfunction(x) or inspect.ismethod(x))
   for k in t_methods:
     name = "%s.%s" % (cls.__name__, k[0])
     self.webkit.listen(name, k[1])
Пример #2
0
  def __init__(self, base, path):
    self.base = base
    self.path = path
    self.config = IConfig
    self.session = ISession
    self.__handlers = {}

    # Resolve own dependencies
    pau.resolve(self)
    self.assets = self.session.assets
Пример #3
0
  def setup(self):
    """ Setup db and return instance """
    self.config = pau.IConfig
    self.session = pau.ISession
    pau.resolve(self)

    self.session.assets = Assets()
    self.config.db = self.db_name

    self.db = pau.IDb
    pau.resolve(self)

    self.prefs = pau.model.Prefs()
    self.controller = Utils()
    pau.resolve_children(self)

    # Instance
    return self.controller
Пример #4
0
  def setup(self):
    """ Setup db and return instance """
    self.config = pau.IConfig
    self.session = pau.ISession
    pau.resolve(self)

    self.session.assets = Assets()
    self.config.db = self.db_name
    self.config.db_debug = False

    self.db = pau.IDb
    pau.resolve(self)

    self.prefs = Prefs()
    pau.resolve(self.prefs)

    # Instance
    i = Home()
    pau.resolve(i)
    return i
Пример #5
0
  def setup(self):
    """ Setup db and return instance """
    self.config = pau.IConfig
    self.session = pau.ISession
    pau.resolve(self)

    self.session.assets = Assets()
    self.config.db = self.db_name

    self.db = pau.IDb
    pau.resolve(self)

    # Instance
    i = Setup()
    pau.resolve(i)
    return i
Пример #6
0
  def setup(self):
    """ Setup db and return instance """

    # Setup test db
    self.config = pau.IConfig
    self.session = pau.ISession
    pau.resolve(self)
    self.session.assets = Assets()
    self.config.db = self.db_name

    # Load db for reset later
    self.db = pau.IDb
    pau.resolve(self)

    # Instance
    i = Prefs()
    pau.resolve(i)
    return i