当前位置: 首页>>代码示例>>Python>>正文


Python User.getUser方法代码示例

本文整理汇总了Python中models.User.getUser方法的典型用法代码示例。如果您正苦于以下问题:Python User.getUser方法的具体用法?Python User.getUser怎么用?Python User.getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.User的用法示例。


在下文中一共展示了User.getUser方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: makeFakeInfo

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
    def makeFakeInfo(cls,user_id):

        info=[
        {
        "type":"phone",
        "title":u"手机",
        "text":"15250411234",
        "index":"0"
        },
        {
        "type":"phone",
        "title":u"电话",
        "text":"6656123",
        "index":"1"
        },
        {
        "type":"mail",
        "title":u"邮箱",
        "text":"[email protected]",
        "index":"2"
        },
        {
        "type":"link",
        "title":u"网址",
        "text":"http://oriental13.lofter.com",
        "index":"3"
        },
        {
        "type":"address",
        "title":u"地址",
        "text":"上海",
        "index":"4"
        },
        {
        "type":"social",
        "title":u"微信",
        "text":"abao",
        "index":"5"
        }
        ]
        intro={
        "type":"intro",
        "title":u"个人简介",
        "text":"热爱互联网的设计师"
        }
        user = User.getUser(user_id)
        user.headpic = os.path.join(upload_path, "fake_headpic.png")
        user.logo = os.path.join(upload_path,"fake_logo.png")
        user.qrcode = os.path.join(upload_path,"fake_qrcode.png")


        # c = Contact(_type = intro["type"] ,title = intro["title"] , text = intro["text"],user_id=user_id )
        # db.session.add(c)
        # print "@@@"
        # for i in info:
        #     c = Contact(_type = i["type"] ,title = i["title"] , text = i["text"],index = i["index"] ,user_id=user_id )
        #     db.session.add(c)
        print "22"
        db.session.commit()
        print "####"
开发者ID:hanxiaomax,项目名称:card_and_code,代码行数:62,代码来源:tools.py

示例2: getcarddetail

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
    def getcarddetail(cls,user_id):
        user = User.getUser(user_id)
        # c = Contact.query.filter(db.or_(user_id==user_id)).all()
        info=[]
        intro=[]
        custom=[]
        for item in user.contact.all():
            if item._type == "intro":
                temp={"title":item.title,"text":item.text,"type":item._type}
                intro.append(temp)
            elif item._type == "custom":
                temp={"title":item.title,"text":item.text,"type":item._type}
                custom.append(temp)
            else:
                temp={"title":item.title,"text":item.text,"type":item._type,"index":item.index}
                info.append(temp)

        dic = {
        "name":user.name,
        "corp":user.corp,
        "position":user.position,
        "info":info,
        "intro":intro,
        "custom":custom,
        "logoText":user.logoText if user.logoText else "",
        "headpic":os.path.basename(user.headpic) if user.headpic  else "default_headpic.png",
        "logo":os.path.basename(user.logo) if user.logo  else "default_logo.png",
        "qrcode":os.path.basename(user.qrcode) if user.qrcode  else None
        }
        return jsonify(dic)
开发者ID:hanxiaomax,项目名称:card_and_code,代码行数:32,代码来源:tools.py

示例3: post

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
    def post(self):
        form = json.loads(self.request.body)        
        user = User.getUser(form['user_id'])
        if not user:
            return self.respond(status='User %(user_id)r not found' % form)
        user.delete()

        self.respond(status='Deleted user %(user_id)r' % form)
开发者ID:tgarc,项目名称:apt-miniproject,代码行数:10,代码来源:services.py

示例4: getBrife

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
def getBrife(user_id):
    user = User.getUser(user_id)
    dic = {
    "name":user.name,
    "corp":user.corp,
    "position":user.position,
    "headpic":os.path.basename(user.headpic) if user.headpic  else "default_headpic.png",
    }
    return dic
开发者ID:hanxiaomax,项目名称:card_and_code,代码行数:11,代码来源:tools.py

示例5: getAddressList

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
 def getAddressList(cls,user_id):
     user = User.getUser(user_id)
     data={
     "type":"data",
     "datalist":[]
     }
     for item in user.shipAddress.all():
         temp={"name":item.name,"phone":item.phone,"address":item.address,"index":item.id}
         data["datalist"].append(temp)
     return jsonify(data)
开发者ID:hanxiaomax,项目名称:card_and_code,代码行数:12,代码来源:tools.py

示例6: post

# 需要导入模块: from models import User [as 别名]
# 或者: from models.User import getUser [as 别名]
    def post(self):
        user = User.getUser(self.request.get('user_id'))
        if not user:
            logging.error("User does not exist.")
            return self.redirect('/login')            
        elif self.request.get('user_pw') != user.user_pw:
            logging.error("Bad password.")
            return self.redirect('/login')

        for key,link in NAV_LINKS.items():
            USER_NAV_LINKS[key] = link+'?'+urllib.urlencode({'user_id':user.user_id})

        return self.redirect('/manage',{'user_id':user.user_id})
开发者ID:tgarc,项目名称:apt-miniproject,代码行数:15,代码来源:miniproject.py


注:本文中的models.User.getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。