Ejemplo n.º 1
0
 def stats(self):
     cmd = """
         select value, count(*) as count
         from attributes
         where kind=%s and attribute="topic"
         group by value
         """
     kind = EntityStore(self.db, Message).kind
     return self.db(cmd, kind)
Ejemplo n.º 2
0
 def topics(self):
     cmd = """
         select distinct value
         from attributes
         where kind=%s and attribute="topic"
         order by value
         """
     kind = EntityStore(self.db, Message).kind
     return [a for a, in self.db(cmd, kind)]
Ejemplo n.º 3
0
    def __init__(self, store, config, context):
        from .store import EntityStore
        self.db = store.db

        self.application_settings_store = EntityStore(self.db,
                                                      ApplicationSettings)
        self._application_dict = {
            p.key: p.value
            for p in self.application_settings_store
        }

        self.user_settings_store = EntityStore(self.db, UserSystemSettings)
        self._user_dict = {p.key: p.value for p in self.user_settings_store}

        self.store = store
        self.klass = store.klass
        self.context = context
        self.config = config
        self.refresh()
Ejemplo n.º 4
0
 def __init__(self, name, newest=None, db=None):
     self.name = name
     self.db = db
     self.messages = EntityStore(db, Message)
     self.newest = newest != None and newest or self.last() or -1
Ejemplo n.º 5
0
 def __str__(self):
     return str(EntityStore(self.db, Message))
Ejemplo n.º 6
0
 def clear(self):
     return EntityStore(self.db, Message).zap()
Ejemplo n.º 7
0
 def app(self, app_name):
     """ return an app settings object from the site settings """
     from zoom import manager, EntityStore
     return Settings(EntityStore(self.store.db, ApplicationSettings),
                     manager.get_app(app_name), app_name)