Пример #1
0
	def GET(self,tips=None):
		user = self.getcurrentuser()
		#所有RSS源和已订阅的源
		ownfeeds = model.userid2feeds(user.k_id) if user else None
		books = list(model.get_allbooks())#webpy返回的是storage对象,用一次就不见了
		category = list(model.get_category())
		return jjenv.get_template("my.html").render(nickname=session.username,current='my',title='My subscription',books=books,ownfeeds=ownfeeds,tips=tips,level=user.level,cate=category)
Пример #2
0
    def POST(self):
        email = web.input(email=None).email
        pidlist = model.get_pid_by_email(email)
        pids = {}
        for itr in pidlist:
            pids[itr.pid] = True
        sublist = model.get_pattern()
        subs = []
        for pat in sublist:
            if pids.get(pat.pid):
                subs.append({"name": pat.name,
                             "pattern": pat.pattern,
                             "pid": pat.pid,
                             "cid": pat.cid,
                             "checked": " checked "})
            else:
                subs.append({"name": pat.name,
                             "pattern": pat.pattern,
                             "pid": pat.pid,
                             "cid": pat.cid,
                             "checked": ""})

        category = model.get_category()

        return snippet.sublist(category, subs)
Пример #3
0
 def patlist(self):
     patterns = [{"name": pat.name,
                  "pattern": pat.pattern,
                  "pid": pat.pid,
                  "cid": pat.cid}
                 for pat in model.get_pattern()]
     return snippet.patlist(model.get_category(), patterns)
Пример #4
0
 def GET(self, tips=None):
     user = self.getcurrentuser()
     ownfeeds = model.userid2feeds(user.k_id) if user else None
     books = list(model.get_allbooks())  #webpy返回的是storage对象,用一次就不见了
     category = list(model.get_category())
     return jjenv.get_template("mysub.html").render(
         nickname=session.username,
         current='mysub',
         title='My subscription',
         books=books,
         ownfeeds=ownfeeds,
         tips=tips,
         level=user.level,
         cate=category)
Пример #5
0
		model.new_comment(post_id, author, '192.168.1.1', 'firefox 4.0', content)

	comments = model.get_comments()
	assert(comments and len(comments) == 10 and model.get_comment_num(post_id) == 10)

	ci = 9 
	for c in comments:
		assert(c.post_id == post_id and c.author == 'author %d' %ci and c.author_ip == '192.168.1.1' and c.comment_agent == 'firefox 4.0' and c.content == 'comment %d' %ci and c.url == None and c.email == None and c.reply_notify_mail == False)
		ci -= 1

	############start test category, now there is only default category.
	cid1 = model.new_category('category 1', 0, 'description 1')

	categories = model.get_all_categories()

	assert(len(categories) == 2 and cid1 > 0)

	for c in categories:
		if cid1 == c.id:
			assert(c.name == 'category 1' and c.parent_id == 0 and c.description == 'description 1')
	
	assert(model.update_category(cid1, name='new category 1', description='new description 1', parent_id=1))
	
	c1 = model.get_category(cid1)
	assert (c1.name == 'new category 1' and c1.parent_id == 1 and c1.description == 'new description 1')
	
	assert(model.delete_category(cid1))
	assert(len(model.get_all_categories()) == 1)

	
Пример #6
0
 def GET(self, action):
     patlist = self.patlist()
     category = model.get_category()
     return render.pattern(category, patlist)