Example #1
0
 def post(self):
     page = self.request.get('page_Id')
     father = replaceStr(self.request.get('father'))
     code=replaceStr(self.request.get('code'))
     if not ContentClass.get_by_key_name(code):
         content = ContentClass(key_name=code)
         content.maincode = replaceStr(self.request.get('maincode'))
         content.title = replaceStr(self.request.get('title'))
         content.content = replaceStr(self.request.get('content'),'[()]')
         content.updateSpanTime = replaceStr(self.request.get('updateSpanTime'))
         content.father = father
         content.userName = replaceStr(self.request.get('userName'))
         content.replyType = replaceStr(self.request.get('replyType'))
         content.level = getLevelByCode(code)
         content.status = "1"
         content.put()
         logging.info(content.key().name())
         self.redirect('/contentList/%s?father=%s' %(page,father))
     else:
         self.redirect(self.request.environ['HTTP_REFERER'])
Example #2
0
def addInit(username,realName='',tel='',mtel=''):

#    content = ContentClass(key_name='a999-1-s1-'+username)
#    content.maincode = 'a999'#主编号
#    content.father = 'a999-1-s1'#父级
#    content.content = '****'#内容
#    content.replyType = '1'
#    content.status = '1'
#    content.level='101'
#    content.userName=username
#    content.put()

    content =ContentClass.get_by_key_name(key_names='a999-1-s1-'+username)
    if not content:
        content = ContentClass(key_name='a999-1-s1-'+username)
    content.maincode = 'a999'#主编号
    content.father = 'a999-1-s1'#父级
    content.content = '****'#内容
    content.replyType = '1'
    content.status = '1'
    content.level='101'
    content.userName=username
    content.put()
    
#    s=Subscribe.get_by_key_name(key_names='a888u'+username)
#    if not s:
#        s=Subscribe(key_name='a888u'+username)
#    s.userName=username
#    s.code='a888'
#    s.level='1'
#    s.maincode='a888'
#    s.subscribeType='0'
#    s.status='1'
#    s.put()
    content =ContentClass.get_by_key_name(key_names='a999-2-s1-'+username)
    if not content:
        content = ContentClass(key_name='a999-2-s1-'+username)
    content.maincode = 'a999'#主编号
    content.father = 'a999-2-s1'#父级
    content.content = '*;*1*3*4*'#内容
    content.replyType = '15'
    content.status = '1'
    content.level='101'
    content.userName=username
    content.put()
    code='a888-s1-3'
    content =ContentClass.get_by_key_name(key_names=code+'-'+username)
    if not content:
        content = ContentClass(key_name=code+'-'+username)
    content.maincode = 'a888'#主编号
    content.father = code#父级
    content.content = '1'#内容
    content.replyType = '16'
    content.status = '1'
    content.level='102'
    content.userName=username
    content.put()
    code='a888-s1-4'
    content =ContentClass.get_by_key_name(key_names=code+'-'+username)
    if not content:
        content = ContentClass(key_name=code+'-'+username)
    content.maincode = 'a888'#主编号
    content.father = code#父级
    content.content = '1'#内容
    content.replyType = '16'
    content.status = '1'
    content.level='102'
    content.userName=username
    content.put()
    code='a888-s1-777'
    content =ContentClass.get_by_key_name(key_names=code+'-'+username)
    if not content:
        content = ContentClass(key_name=code+'-'+username)
    content.maincode = 'a888'#主编号
    content.father = code#父级
    content.content = '1'#内容
    content.replyType = '16'
    content.status = '1'
    content.level='102'
    content.userName=username
    content.put()
    #默认订阅微博
#    s=Subscribe.get_by_key_name(key_names='a999-2u'+username)
#    if not s:
#        s=Subscribe(key_name='a999-2u'+username)
#    s.userName=username
#    s.code='a999-2'
#    s.level='2'
#    s.father='a999'
#    s.maincode='a999'
#    s.subscribeType='0'
#    s.status='1'
#    s.put()
#    s=Subscribe.get_by_key_name(key_names='a3u'+username)
#    if not s:
#        s=Subscribe(key_name='a3u'+username)
#    s.userName=username
#    s.code='a3'
#    s.level='1'
#    s.maincode='a3'
#    s.subscribeType='1'
#    s.status='1'
#    s.put()
    s=Subscribe.get_by_key_name(key_names='a4u'+username)
    if not s:
        s=Subscribe(key_name='a4u'+username)
    s.userName=username
    s.code='a4'
    s.level='1'
    s.maincode='a4'
    s.subscribeType='0'
    s.status='1'
    s.put()
    s=Subscribe.get_by_key_name(key_names='a777u'+username)
    if not s:
        s=Subscribe(key_name='a777u'+username)
    s.userName=username
    s.code='a777'
    s.level='1'
    s.maincode='a777'
    s.subscribeType='1'
    s.status='1'
    s.put()
Example #3
0
    def get(self, *args):
        fromurl = "/top"
        if not ContentClass.get_by_key_name("a3"):
            content = ContentClass(key_name="a3")
            content.maincode = "a3"
            content.level = "1"
            content.title = u"微博"
            content.content = u"[*sys/001/a777_1*]微博"
            content.status = "1"
            content.updateSpanTime = "100"
            content.put()
        if not ContentClass.get_by_key_name("a4"):
            content = ContentClass(key_name="a4")
            content.maincode = "a4"
            content.level = "1"
            content.title = u"即时通讯"
            content.content = u"[*sys/002/a777_1*]即时通讯"
            content.status = "1"
            content.updateSpanTime = "100"
            content.put()
        if not ContentClass.get_by_key_name("a777"):
            content = ContentClass(key_name="a777")
            content.maincode = "a777"
            content.level = "1"
            content.title = u"系统图库"
            content.content = u"[*sys/003/a777_1*]系统图库"
            content.status = "1"
            content.updateSpanTime = "100"
            content.put()
        if not ContentClass.get_by_key_name("a888"):
            content = ContentClass(key_name="a888")
            content.maincode = "a888"
            content.level = "1"
            content.title = u"应用列表"
            content.content = u"[*sys/004/a777_1*]应用列表"
            content.status = "1"
            content.updateSpanTime = "100"
            content.put()
        if not ContentClass.get_by_key_name("a888-s1"):
            content = ContentClass(key_name="a888-s1")
            content.maincode = "a888"
            content.father = "a888"
            content.level = "100"
            content.content = u"应用列表"
            content.status = "1"
            content.replyType = "16"
            content.put()
        if not ContentClass.get_by_key_name("a888-s1-3"):
            content = ContentClass(key_name="a888-s1-3")
            content.maincode = "a888"
            content.father = "a888-s1"
            content.level = "101"
            content.title = "a3;a3_1:weibo.zxxsbook.com,a3_2:weibo.zxxsbook.com"
            content.content = u"微博应用这是微博应用的简介"
            content.status = "1"
            content.replyType = "16"
            content.put()
        if not ContentClass.get_by_key_name("a888-s1-4"):
            content = ContentClass(key_name="a888-s1-4")
            content.maincode = "a888"
            content.father = "a888-s1"
            content.level = "101"
            content.title = "a4;a4_1:im.zxxsbook.com"
            content.content = u"即时通讯应用,这是即时通讯应用的简介"
            content.status = "1"
            content.replyType = "16"
            content.put()
        if not ContentClass.get_by_key_name("a888-s1-777"):
            content = ContentClass(key_name="a888-s1-777")
            content.maincode = "a888"
            content.father = "a888-s1"
            content.level = "101"
            content.title = "a777;a777_1:imglib.zxxsbook.com"
            content.content = u"系统图库的简介"
            content.status = "1"
            content.replyType = "16"
            content.put()
        if not ContentClass.get_by_key_name("a999"):
            contentclass = ContentClass(key_name="a999")
            contentclass.title = u"系统设置"
            contentclass.content = u"[*sys/005/a777_1*]系统设置"
            contentclass.maincode = "a999"
            contentclass.level = "1"
            contentclass.status = "1"
            contentclass.updateSpanTime = "100"
            contentclass.put()

        if not ContentClass.get_by_key_name("a999-2"):
            contentclass = ContentClass(key_name="a999-2")
            contentclass.title = u"微博授权"
            contentclass.content = u"微博授权"
            contentclass.maincode = "a999"
            contentclass.father = "a999"
            contentclass.level = "2"
            contentclass.status = "1"
            contentclass.updateSpanTime = "100"
            contentclass.put()
        if not ContentClass.get_by_key_name("a999-2-s1"):
            contentclass = ContentClass(key_name="a999-2-s1")
            contentclass.content = u"微博授权"
            contentclass.maincode = "a999"
            contentclass.father = "a999-2"
            contentclass.level = "100"
            contentclass.status = "1"
            contentclass.replyType = "15"
            contentclass.put()
        #        if not ContentClass.get_by_key_name("a9999"):
        #            contentclass=ContentClass(key_name='a9999')
        #            contentclass.code='a9999'
        #            contentclass.title=u'系统消息'
        #            contentclass.content=u'系统消息'
        #            contentclass.maincode='a9999'
        ##            contentclass.father='a999'
        #            contentclass.level='1'
        #            contentclass.status='1'
        #            contentclass.updateSpanTime='100'
        #            contentclass.put()
        if not ContentClass.get_by_key_name("a999-9"):
            contentclass = ContentClass(key_name="a999-9")
            contentclass.title = u"修改密码"
            contentclass.content = u"修改密码"
            contentclass.maincode = "a999"
            contentclass.father = "a999"
            contentclass.level = "2"
            contentclass.status = "1"
            contentclass.updateSpanTime = "100"
            contentclass.put()
        if not ContentClass.get_by_key_name("a999-9-s1"):
            contentclass = ContentClass(key_name="a999-9-s1")
            #            contentclass.title=u'修改密码'
            contentclass.content = u"修改密码"
            contentclass.maincode = "a999"
            contentclass.father = "a999-9"
            contentclass.level = "100"
            contentclass.replyType = "5"
            contentclass.status = "1"
            #            contentclass.updateSpanTime='100'
            contentclass.put()
        if not ContentClass.get_by_key_name("a999-9-s1-1"):
            contentclass = ContentClass(key_name="a999-9-s1-1")
            contentclass.content = u"**原始密码#10#**新密码#10#**"
            contentclass.maincode = "a999"
            contentclass.father = "a999-9-s1"
            contentclass.level = "101"
            contentclass.replyType = "5"
            contentclass.status = "1"
            contentclass.put()
        if not User.get_by_keyname(key_names="u000"):
            u = User(key_name="u3u000")
            u.userName = "******"
            u.passWord = "******"
            u.put()
        if not Subscribe.get_by_key_name(key_names="a999u000"):
            s = Subscribe(key_name="a999u000")
            s.userName = "******"
            s.code = "a999"
            s.level = "1"
            s.father = ""
            s.maincode = "a999"
            s.subscribeType = "1"
            s.status = "1"
            s.put()
        #        if not Subscribe.get_by_key_name(key_names='a9999u000'):
        #            s=Subscribe(key_name='a9999u000')
        #            s.userName='******'
        #            s.code='a9999'
        #            s.level='1'
        #            s.father=''
        #            s.maincode='a9999'
        #            s.subscribeType='0'
        #            s.status='1'
        #            s.put()
        if not Subscribe.get_by_key_name(key_names="a888u000"):
            s = Subscribe(key_name="a888u000")
            s.userName = "******"
            s.code = "a888"
            s.level = "1"
            s.father = ""
            s.maincode = "a888"
            s.subscribeType = "0"
            s.status = "1"
            s.put()
        if not Subscribe.get_by_key_name(key_names="a999-9u000"):
            s = Subscribe(key_name="a999-9u000")
            s.status = "1"
            s.subscribeType = "0"
            s.userName = "******"
            s.maincode = "a999"
            s.code = "a999-9"
            s.father = "a999"
            s.level = "2"
            s.put()
        self.redirect(fromurl)
Example #4
0
def doDingYue(self):
    username = self.request.get("UserName")
    docontent = self.request.get("Content")
    #    m=self.request.get('MainCode')
    code = self.request.get("Code")
    c = code.split("-")
    if "3" == c[-1]:
        if "1" == docontent:
            content = ContentClass.get_by_key_name(key_names="a999-2-s1-" + username)
            if not content:
                content = ContentClass(key_name="a999-2-s1-" + username)
            content.maincode = "a999"  # 主编号
            content.father = "a999-2-s1"  # 父级
            content.content = "*;*1*2*3*4*"  # 内容
            content.replyType = "15"
            content.status = "1"
            content.level = "101"
            content.userName = username
            content.put()
            content = ContentClass.get_by_key_name(key_names=code + "-" + username)
            if not content:
                content = ContentClass(key_name=code + "-" + username)
            content.maincode = "a888"  # 主编号
            content.father = code  # 父级
            content.content = "1"  # 内容
            content.replyType = "16"
            content.status = "1"
            content.level = "102"
            content.userName = username
            content.put()
            s = Subscribe.get_by_key_name(key_names="a999-2u" + username)
            if not s:
                s = Subscribe(key_name="a999-2u" + username)
            s.userName = username
            s.code = "a999-2"
            s.level = "2"
            s.father = "a999"
            s.maincode = "a999"
            s.subscribeType = "0"
            s.status = "1"
            s.put()
            s = Subscribe.get_by_key_name(key_names="a3u" + username)
            if not s:
                s = Subscribe(key_name="a3u" + username)
            s.userName = username
            s.code = "a3"
            s.level = "1"
            s.maincode = "a3"
            s.subscribeType = "1"
            s.status = "1"
            s.put()
            self.response.out.write(WEBURL[7:] + "/InfoUpdate;")
            content = ContentClass.get_by_key_name(key_names=code)
            if content:
                try:
                    self.response.out.write(content.title.split(";")[1].split(",")[0].split(":")[1] + "/InfoAll;")
                    self.response.out.write(content.title.split(";")[1].split(",")[0].split(":")[1] + "/InfoUpdate")
                except Exception, e:
                    logging.info("error:" + content.title)
            return
        else:
            content = ContentClass.get_by_key_name(key_names="a999-2-s1-" + username)
            if content:
                content.status = "0"
                content.put()
            user = User.get_by_keyname("u" + username)
            if user:
                appmap = user.getParms()
                if appmap.has_key("a3"):
                    del appmap["a3"]
                user.put()
            content = ContentClass.get_by_key_name(key_names=code + "-" + username)
            if content:
                content.content = "0"
                content.put()
            s = Subscribe.get_by_key_name(key_names="a999-2u" + username)
            if s:
                s.status = "0"
                s.put()
            s = Subscribe.get_by_key_name(key_names="a3u" + username)
            if s:
                s.status = "0"
                s.put()
            self.response.out.write(WEBURL[7:] + "/InfoUpdate")
            return