Пример #1
0
 def get_kws_mgt_kws_info(self, kws_id):
     ps = PropStore()
     ps.kws_id = kws_id
     ps.org_name = ""
     ps.user_list = []
     
     cur = db_session.execute(("SELECT creation_date, name FROM kcd_kws_list WHERE kws_id = %i") % (kws_id))
     row = cur.fetchone()
     if row == None: raise ErrorMsg("Teambox %i not found" % (kws_id))
     ps.creation_date = row["creation_date"]
     ps.name = ltu(row["name"])
     cur.close()
     
     cur = db_session.execute(("SELECT file_size, file_quota FROM kcd_kws_kfs_limit WHERE kws_id = %i") % (kws_id))
     row = cur.fetchone()
     if row == None: raise ErrorMsg("Teambox %i not found" % (kws_id))
     ps.file_quota = row["file_quota"]
     ps.file_size = row["file_size"]
     cur.close()
     
     cur = db_session.execute(("SELECT user_id, email, name_admin, name_user, org_name FROM " +\
                               "kcd_kws_users WHERE kws_id = %i ORDER BY user_id") % (kws_id))
     for row in cur.fetchall():
         user = PropStore()
         user.user_id = row["user_id"]
         user.email = ltu(row["email"])
         if row["name_admin"] != "": user.name = ltu(row["name_admin"])
         elif row["name_user"] != "": user.name = ltu(row["name_user"])
         else: user.name = ""
         user.org_name = ltu(row["org_name"])
         ps.user_list.append(user)
     db_session.rollback()
     if len(ps.user_list): ps.org_name = ps.user_list[0].org_name
     return ps
Пример #2
0
 def get_kws_mgt_nb_kws(self):
     cur = db_session.execute("SELECT count(kws_id) FROM kcd_kws_list WHERE (flags & %d = 0)" %\
                              (KANP_KWS_FLAG_DELETE))
     row = cur.fetchone()
     if not row: raise Exception("cannot get number of Teamboxes")
     nb_kws = row[0]
     db_session.rollback()
     return nb_kws
Пример #3
0
 def get_kws_mgt_kws_list(self, offset, limit):
     l = []
     cur = db_session.execute(("SELECT kws_id FROM kcd_kws_list WHERE (flags & %d = 0) " +\
                               "ORDER BY kws_id OFFSET %i LIMIT %i") % \
                              (KANP_KWS_FLAG_DELETE, offset, limit))
     for row in cur.fetchall(): l.append(row[0])
     db_session.rollback()
     return l