示例#1
0
 def get(self,page):
     prevValue = self.request.get('prevValue')
     father = self.request.get('father')
     if father =='':
         level = '1'
         contents=ContentClass.all().filter('level =',level).order('__key__')
         #contents = db.GqlQuery("SELECT * FROM ContentClass WHERE level = :1 ORDER BY code ASC", level)
         totalcount=contents.count(limit=1000000)
     else:
         level = str(int(getLevelByCode(father))+1)
         contents=ContentClass.all().filter('father =',father).order('__key__')
         #contents = db.GqlQuery("SELECT * FROM ContentClass WHERE father=:1 ORDER BY code ASC",father)
         totalcount=contents.count(limit=1000000)
     if level=='5':
         level = None
     fatherList = findFather(father)
     index=0 if page=="" else int(page)
     num=0 if index==0 else 1
     contents = contents.fetch(16+2^num,index*16-num)
     count=len(contents)
     for i in range(count):
         p,n=None,None
         c=contents[i]
         if i<count-1:
             n=contents[i+1]
         if i!=0:
             p=contents[i-1]
         if p:
             c.prev=p.key().name()
         if n:
             c.next=n.key().name()
     if num==1:
         contents=contents[1:17]
     else:
         contents=contents[0:16]
     if index!=0:
         if len(contents)==0:
             self.redirect('/contentList/%s?father=%s' %(index-1,father))
     prev,next=None,None
     if len(contents)>0:
         if contents[0].__dict__.has_key('prev') :
             prev=contents[0].prev
         else:
             prev=None
         next=str(contents[0].key().name())
     prevpage,nextpage=getPageing(len(contents), index)
     template_values = {"contents":contents,"contentlength":len(contents),"fatherList":fatherList,"prev":prev,"next":next,"prevpage":prevpage,"nextpage":nextpage,"index":index,"father":father,"level":level,"prevValue":prevValue,'lastpage':totalcount/16}
     self.render('template/content/zxlist.html',template_values)
示例#2
0
    def get(self):
        if not checkUser(self):
            self.response.out.write("1")
            return
        userName = self.request.get("UserName").strip()
        xml = None
        datas = None
        codeListAll = []  # 全要型的订阅
        codeListPart = []  # 只要本层订阅方式
        deleteListCode = []
        for sub in Subscribe.all().filter("userName in", [userName, "000"]).filter("status =", "1"):
            if "0" == sub.subscribeType:
                codeListAll.append(sub.code)
            codeListPart.append(sub.code)

        xml, datas = infoallxmldic(ContentClass.get_by_key_name(codeListPart), xml, datas)
        for c in codeListAll:
            xml, datas = infoallxmldic(findChildNodes(c).filter("userName ="******""), xml, datas)
        xml, datas = infoallxmldic(
            ContentClass.all().filter("userName ="******"status =", "1"), xml, datas
        )
        datas.setAttribute("type", "infoall")
        datas.setAttribute("code", "main")
        datas.setAttribute("verson", AppPhoneVerson)
        datas.setAttribute("download", AppPhoneUri)
        userAppData(userName, datas)
        self.response.out.write(xml.toxml("utf-8"))
        return
示例#3
0
 def get(self):
     userName = self.request.get('userName')
     father = self.request.get('father')
     code=self.request.get('code')
     if father:
         if code:
             contents=ContentClass.all().filter('father =',father).filter('status =','1').filter('__key__ >=',ContentClass(key_name=code).key()).filter('__key__ <=',ContentClass(key_name=code+u"\ufffd").key()).order('__key__')
         else:
             contents=ContentClass.all().filter('father =',father).filter('status =','1').order('__key__')
     else:
         if code:
             contents=ContentClass.all().filter('__key__ >=',ContentClass(key_name=code).key()).filter('__key__ <=',ContentClass(key_name=code+u"\ufffd").key()).filter('level =','1').filter('status =','1').order('__key__')
         else:
             contents = ContentClass.all().filter('level =','1').filter('status =','1').order('__key__')
     userMap=getUserSub(userName)
     template_values = {'userName':userName,"contents":contents,'father':father,'code':code,'userSub':userMap or {}}
     self.render('template/subscribe/userSubscribeAdd.html',template_values)#本地上运行用这个
示例#4
0
    def get(self):
        #datetime.now()+timedelta(hours=-10)
        t1=datetime.now()+timedelta(hours=-241)
        for con in ContentClass.all().filter('status =','0').fetch(60):
            if (t1-con.lastUpdateTime).days>=10:
                con.delete()
#            pass
#        db.delete(ContentClass.all().filter('status =','0').filter('lastUpdateTime <',datetime.now()+timedelta(hours=-240)).fetch(30))
#        t1=timedelta(9, 86383, 314441).
#        t1
示例#5
0
 def get(self):
   userName = self.request.get('userName')
   if userName=='000':
       return
   index = self.request.get('index')
   user=User.get_by_keyname('u'+userName)
   if user:
       user.delete()
   sq=Subscribe.all().filter('userName ='******'u'+userName)
       if u:
           u.delete()
   contentq=ContentClass.all().filter('userName ='******'/userList/%s' %index)
示例#6
0
def findChildNodes(code,status=None):
    if status:
        return ContentClass.all().filter('status =',status).filter('__key__ >',ContentClass(key_name=code+'-').key()).filter('__key__ <',ContentClass(key_name=code+u"-\ufffd").key())
    else:
        return ContentClass.all().filter('__key__ >',ContentClass(key_name=code+'-').key()).filter('__key__ <',ContentClass(key_name=code+u"-\ufffd").key())