Browse files

modify to Model

  • Loading branch information...
1 parent a8f8d3c commit ae3789e0f573f4f957b42415ce282ba927dc60d4 @wizardcypress wizardcypress committed Oct 6, 2012
Showing with 8 additions and 12 deletions.
  1. +3 −12 model/Model.py
  2. +5 −0 test/model_test.py
View
15 model/Model.py
@@ -332,7 +332,6 @@ class Post(Model):
'''
- #_prefix = 'argo_filehead_%s'
_index_table = 'argo_filehead'
_junk_table= 'argo_filehead_junk'
@@ -743,18 +742,11 @@ def get_mail_counter(self, userid):
return lambda : func(sql)['sum']
def get_mail(self, userid, start, limit):
- try:
- return self.db.query("SELECT * FROM `%s` "
+ return self.db.query("SELECT * FROM `%s` "
"WHERE touserid=%%s "
"ORDER BY mid "
"LIMIT %%s,%%s" % (self._index_table), userid,
start, limit)
- except ProgrammingError as e:
- if e.args[0] == 1146 : # Table NOT EXIST
- self._create_table(self._tableid(touid))
- return []
- else:
- raise e
def get_mid_rank(self, touserid, mid):
return self.db.get('SELECT count(*) as sum'
@@ -961,7 +953,6 @@ class ReadMark(Model):
keyf = "argo:readmark:%s:%s"
limit_max = 200
- limit_clear = -50
def __(self,userid,boardname):
return self.keyf%(userid,boardname)
@@ -1405,8 +1396,8 @@ def new_post(self,boardname,userid,title,content,
return pid
def reply_post(self,boardname,userid,title,content,addr,
- host,replyid,replyable,signature):
- post = self.post.get_post(boardname, replyid)
+ host,replyid,replyable = 1,signature = ''):
+ post = self.post.get_post(replyid)
tid = post['tid']
bid = self.board.name2id(boardname)
pid = self.post.add_post(
View
5 test/model_test.py
@@ -96,6 +96,11 @@ def reply_mail(self, userid, mid, content):
def register(self, userid, passwd):
print mgr.auth.register(userid, passwd)
+ ###### Favorite ############
+
+ def add_fav(self, userid, boardname):
+ print mgr.favourite.add(userid, boardname)
+
def main():
t = TestSuit()
if len(sys.argv) < 2: t.usage()

0 comments on commit ae3789e

Please sign in to comment.