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


Python User.get_public_properties方法代码示例

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


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

示例1: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_public_properties [as 别名]
 def get(self, username):
     """Loads user's properties. If logged user is admin it loads also non public properties"""
     if auth.is_admin():
         properties = User.get_private_properties()
     else:
         properties = User.get_public_properties()
     traveler_key = getattr(g.user_db,'fellow_traveler',None)
     if traveler_key:
         traveler = traveler_key.get()
         future=False
     else:
         traveler = model.FellowTraveler.create_or_update(
                 name=g.user_db.name,
                 email=g.user_db.email,
                 avatar_url=g.user_db.avatar_url,
                 parent=g.user_db.key,
                 added_by=g.user_db.key)
         traveler_key =traveler.put()
         traveler.key = traveler_key
         g.user_db.fellow_traveler = traveler_key
         future = g.user_db.put_async()
     db_dict = g.user_db.to_dict(include=properties)
     db_dict["fellow_traveler"] = traveler.to_dict(include=model.FellowTraveler.get_public_properties())
     if future:
         future.get_result()
     return db_dict
开发者ID:derasd,项目名称:woTravel,代码行数:28,代码来源:user_api.py

示例2: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_public_properties [as 别名]
 def get(self, username):
     """Loads user's properties. If logged user is admin it loads also non public properties"""
     if auth.is_admin():
         properties = User.get_private_properties()
     else:
         properties = User.get_public_properties()
     return g.user_db.to_dict(include=properties)
开发者ID:Huijari,项目名称:gae_test,代码行数:9,代码来源:user_api.py

示例3: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_public_properties [as 别名]
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument("cursor", type=ArgumentValidator.create("cursor"))
        args = parser.parse_args()

        users_future = User.query().order(-User.created).fetch_page_async(10, start_cursor=args.cursor)

        total_count_future = User.query().count_async(keys_only=True)
        users, next_cursor, more = users_future.get_result()
        users = [u.to_dict(include=User.get_public_properties()) for u in users]
        return make_list_response(users, next_cursor, more, total_count_future.get_result())
开发者ID:jacraven,项目名称:lsiapp,代码行数:13,代码来源:user_api.py

示例4: put

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import get_public_properties [as 别名]
    def put(self, key):
        """Updates user's properties"""
        update_properties = ['name', 'bio', 'email', 'location', 'avatar_url', 'facebook', 'github',
                             'gplus', 'linkedin', 'twitter', 'instagram']
        if auth.is_admin():
            update_properties += ['verified', 'active', 'admin']

        new_data = _.pick(request.json, update_properties)
        g.model_db.populate(**new_data)
        g.model_db.put()
        #return make_empty_ok_response()
        if auth.is_admin():
            properties = User.get_private_properties()
        else:
            properties = User.get_public_properties()
        return g.model_db.to_dict(include=properties)
开发者ID:derasd,项目名称:woTravel,代码行数:18,代码来源:user_api.py


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