Exemplo n.º 1
0
    def GET(self):
        #return render.index()
        #sql = "select en.id AS entryId, en.title, en.slug, en.content, en.createdTime, c.name AS cat, en.viewNum, en.commentNum from entries en LEFT JOIN categories c ON en.categoryId = c.id ORDER BY en.createdTime asc"
        #entries = list(db.query(sql))
        #for entry in entries:
        #    entry.tags = db.query("select * from tags t left join entry_tag et on t.id=et.tagId where et.entryId=$id", vars={'id': entry.entryId})
        i = web.input(page=1)
        entryCount = web.ctx.orm.query(Entry).count()
        p = Pagination(entryCount, entryPerPage, int(i.page))
        print p.page, p.pages, p.limit
        entries = web.ctx.orm.query(Entry).order_by('createdTime desc')[p.start:p.start + p.limit]
        #print entries
        #for entry in entries:
        #    cutPos = contentLength
        #    if entry.content[contentLength] != u' ':
        #        cutPos = entry.content.find(u' ', contentLength)
        #        print cutPos, contentLength
        #    entry.content = entry.content[:cutPos] + '......'
            #print entry.content
            #for t in entry.tags:
            #    print 'tags:', t.name
        #for entry in entries:
        #    entry.tags = web.ctx.orm.query(entry_tag).join(Tag).filter(entry_tag.entry_id=entry.id)

        d['entries'] = entries
        d['p'] = p
        d['contentLength'] = contentLength
        return render.index(**d)
Exemplo n.º 2
0
    def GET(self):
        #return render.index()
        #sql = "select en.id AS entryId, en.title, en.slug, en.content, en.createdTime, c.name AS cat, en.viewNum, en.commentNum from entries en LEFT JOIN categories c ON en.categoryId = c.id ORDER BY en.createdTime asc"
        #entries = list(db.query(sql))
        #for entry in entries:
        #    entry.tags = db.query("select * from tags t left join entry_tag et on t.id=et.tagId where et.entryId=$id", vars={'id': entry.entryId})
        i = web.input(page=1)
        entryCount = web.ctx.orm.query(Entry).count()
        p = Pagination(entryCount, entryPerPage, int(i.page))
        print p.page, p.pages, p.limit
        entries = web.ctx.orm.query(Entry).order_by(
            'createdTime desc')[p.start:p.start + p.limit]
        #print entries
        #for entry in entries:
        #    cutPos = contentLength
        #    if entry.content[contentLength] != u' ':
        #        cutPos = entry.content.find(u' ', contentLength)
        #        print cutPos, contentLength
        #    entry.content = entry.content[:cutPos] + '......'
        #print entry.content
        #for t in entry.tags:
        #    print 'tags:', t.name
        #for entry in entries:
        #    entry.tags = web.ctx.orm.query(entry_tag).join(Tag).filter(entry_tag.entry_id=entry.id)

        d['entries'] = entries
        d['p'] = p
        d['contentLength'] = contentLength
        return render.index(**d)
Exemplo n.º 3
0
 def POST(self):
     data = web.input()
     username, password = data.username, data.password
     user = User()
     if user.checkLogin(username, password):
         web.setcookie(username, True, 60)
         session.username = username
         return render.index()
     return render.login()
Exemplo n.º 4
0
Arquivo: mis.py Projeto: top/python
	def POST(self):
		data = web.input()
		username, password = data.username, data.password
		user = User()
		if user.checkLogin(username, password):
			web.setcookie(username, True, 60)
			session.username = username
			return render.index()
		return render.login()
Exemplo n.º 5
0
 def GET(self):
     name = 'yuetingqian'
     import web
     path = web.ctx.path
     path_list = path.split('/')
     if len(path_list) > 1:
         tag = path_list[1]
     else:
         tag = path_list[0]
     print path_list
     from dao import query
     app = list(query.get_apps())
     for i in app:
         print i
     print app[0]
     print type(app)
     return render.index(name=name,app=app)
Exemplo n.º 6
0
 def GET(self):
     return render.index()
Exemplo n.º 7
0
 def GET(self):
     return render.index(mirrordb.get_hot_types())
Exemplo n.º 8
0
Arquivo: mis.py Projeto: top/python
	def GET(self):
		return render.index()
Exemplo n.º 9
0
 def GET(self):
     return render.index(mirrordb.get_hot_types())