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


Python Group.name方法代码示例

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


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

示例1: get_groups

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import name [as 别名]
    def get_groups(self, uname):
        # get all groups for this user
        group = None
        user_groups = None
        try:
            collection = self.user_collection
            user_groups = collection.find_one({'_id':uname},{"groups":True})
        except Exception as inst:
            print "error reading groups"
            print inst

        if user_groups != None:
            
            group_cursor = user_groups["groups"]
            groups = []

            for item in group_cursor:
                print item
                group = Group()
                group.id = str(item["_id"])
                group.name = item["name"]
                group.hash = item["hash"]

                groups.append(group)

            return groups
        else:
            return None
开发者ID:nischalhp,项目名称:linkur,代码行数:30,代码来源:userDAO.py

示例2: create_user_groups

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import name [as 别名]
def create_user_groups():

    user = validate_cookie(request)
    print user.__str__()
    responseWrapper = ResponseWrapper()

    print "hello new group"
    response = any_response(request)

    if user != None:

        group = Group()
        try:
            # form_data = request.form['data']
            print request.form
            form_data = request.form['data']
            json_data = json.loads(form_data)
            group.name = json_data['group_name']
            print "appending to group user ", user.id
            group.users.append(user.id)

        except Exception as inst:
            print inst
            print "Error reading form data"
            responseWrapper.set_error(True)
            responseWrapper.set_data([inst])
            response.data = json.dumps(responseWrapper, default=ResponseWrapper.__str__)
            response.mimetype = "application/json"
            return response

        new_group_id = groupDAO.insert_group(group)
        group.id = new_group_id
        result = userDAO.append_group(user.id,group)

        if result != None:
            responseWrapper.set_error(False)
            new_group_id = str(new_group_id)
            responseWrapper.set_data([{"group_id":new_group_id}])
        else:
            responseWrapper.set_error(True)
            responseWrapper.set_data(["error writing group"])

    else:
        responseWrapper.set_error(True)
        responseWrapper.set_data(["User not found. Please login again"])
        response.status_code = 302

    response.data = json.dumps(responseWrapper, default=ResponseWrapper.__str__)
    response.mimetype = "application/json"
    return response
开发者ID:nischalhp,项目名称:linkur,代码行数:52,代码来源:app.py

示例3: get_group_by_hash

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import name [as 别名]
	def get_group_by_hash(self, invite_hash):

		collection = self.collection
		result = collection.find_one({"hash": invite_hash});

		if result != None:
			group = Group()
			group.id = result["_id"]
			# print group.id
			group.name = result["name"]
			group.hash = result["hash"]
			group.users = result["users"]

			return group
		else:
			return None
开发者ID:nischalhp,项目名称:linkur,代码行数:18,代码来源:groupDAO.py

示例4: test_change_some_group_header

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import name [as 别名]
def test_change_some_group_header(app, db, check_ui):
    if len(db.get_group_list()) == 0:
        app.group.create(Group(name="group", header="new", footer="new_1"))
    old_groups = db.get_group_list()
    old_group = random.choice(old_groups)
    id = old_group.id
    group = Group(header="change_new_group")
    app.group.change_by_id(id, group)
    group.id =id
    group.name = old_group.name
    new_groups = db.get_group_list()
    old_groups.insert(old_groups.index(old_group), group)
    old_groups.remove(old_group)
    assert sorted(old_groups, key=Group.id_or_max) == sorted(new_groups, key=Group.id_or_max)
    if check_ui:
        assert sorted(new_groups, key=Group.id_or_max) == sorted(app.group.get_group_list(), key=Group.id_or_max)
开发者ID:KatrinkaYu,项目名称:Task1,代码行数:18,代码来源:test_change_group.py

示例5: get_group_by_id

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import name [as 别名]
	def get_group_by_id(self, group_id):
		# get group document from db

		collection = self.collection
		group_id = ObjectId(group_id)
		result = collection.find_one({"_id": group_id});

		if result != None:
			group = Group()
			group.id = group_id
			# print group.id
			group.name = result["name"]
			group.hash = result["hash"]
			group.users = result["users"]
			
			return group
		else:
			return None
开发者ID:nischalhp,项目名称:linkur,代码行数:20,代码来源:groupDAO.py


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