Esempio n. 1
0
 def __init__(self):
     PostgresBase.__init__(self, 'db_knowl', db)
     self._rw_knowldb = db.can_read_write_knowls()
     # we cache knowl titles for 10s
     self.caching_time = 10
     self.cached_titles_timestamp = 0
     self.cached_defines_timestamp = 0
     self.cached_titles = {}
Esempio n. 2
0
 def __init__(self):
     PostgresBase.__init__(self, 'db_users', db)
     # never narrow down the rmin-rmax range, only increase it!
     self.rmin, self.rmax = -10000, 10000
     self._rw_userdb = db.can_read_write_userdb()
     #TODO use this instead of hardcoded columns names
     #with identifiers
     self._username_full_name = ["username", "full_name"]
     if self._rw_userdb:
         cur = self._execute(SQL("SELECT column_name FROM information_schema.columns WHERE table_schema = %s AND table_name = %s"), ['userdb', 'users'])
         self._cols = [rec[0] for rec in cur]
     else:
         self._cols = self._username_full_name