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


Python current_user._get_current_object函数代码示例

本文整理汇总了Python中udata.auth.current_user._get_current_object函数的典型用法代码示例。如果您正苦于以下问题:Python _get_current_object函数的具体用法?Python _get_current_object怎么用?Python _get_current_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: save

    def save(self, commit=True, **kwargs):
        dataset = super(DatasetCreateForm, self).save(commit=False, **kwargs)
        if not dataset.organization:
            dataset.owner = current_user._get_current_object()

        if commit:
            dataset.save()

        return dataset
开发者ID:guillo-w,项目名称:udata,代码行数:9,代码来源:forms.py

示例2: reject_source

def reject_source(ident, comment):
    '''Reject a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_REFUSED
    if current_user.is_authenticated():
        source.validation.by = current_user._get_current_object()
    source.save()
    return source
开发者ID:anukat2015,项目名称:udata,代码行数:10,代码来源:actions.py

示例3: refuse_transfer

def refuse_transfer(transfer, comment=None):
    '''Refuse an incoming a transfer request'''
    TransferResponsePermission(transfer).test()

    transfer.responded = datetime.now()
    transfer.responder = current_user._get_current_object()
    transfer.status = 'refused'
    transfer.response_comment = comment
    transfer.save()

    return transfer
开发者ID:odtvince,项目名称:udata,代码行数:11,代码来源:actions.py

示例4: validate_source

def validate_source(ident, comment=None):
    '''Validate a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_ACCEPTED
    if current_user.is_authenticated():
        source.validation.by = current_user._get_current_object()
    source.save()
    launch(ident)
    return source
开发者ID:anukat2015,项目名称:udata,代码行数:11,代码来源:actions.py

示例5: save_grant

def save_grant(client_id, code, request, *args, **kwargs):
    # decide the expires time yourself
    expires = datetime.utcnow() + timedelta(seconds=GRANT_EXPIRATION)
    return OAuth2Grant.objects.create(
        client=ObjectId(client_id),
        code=code['code'],
        redirect_uri=request.redirect_uri,
        scopes=request.scopes,
        user=current_user._get_current_object(),
        expires=expires
    )
开发者ID:anukat2015,项目名称:udata,代码行数:11,代码来源:oauth2.py

示例6: validate_source

def validate_source(ident, comment=None):
    '''Validate a source for automatic harvesting'''
    source = get_source(ident)
    source.validation.on = datetime.now()
    source.validation.comment = comment
    source.validation.state = VALIDATION_ACCEPTED
    if current_user.is_authenticated:
        source.validation.by = current_user._get_current_object()
    source.save()
    schedule(ident, cron=current_app.config['HARVEST_DEFAULT_SCHEDULE'])
    launch(ident)
    return source
开发者ID:odtvince,项目名称:udata,代码行数:12,代码来源:actions.py

示例7: save

    def save(self, commit=True, **kwargs):
        '''Register the current user as admin on creation'''
        org = super(OrganizationForm, self).save(commit=False, **kwargs)

        if not org.id:
            user = current_user._get_current_object()
            member = Member(user=user, role='admin')
            org.members.append(member)

        if commit:
            org.save()

        return org
开发者ID:opendatateam,项目名称:udata,代码行数:13,代码来源:forms.py

示例8: post

    def post(self, org, id):
        '''Refuse user membership to a given organization.'''
        membership_request = self.get_or_404(org, id)
        form = api.validate(MembershipRefuseForm)

        membership_request.status = 'refused'
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        membership_request.refusal_comment = form.comment.data

        org.save()

        return {}, 200
开发者ID:pombredanne,项目名称:udata,代码行数:13,代码来源:api.py

示例9: post

    def post(self, org, id):
        """Refuse user membership to a given organization."""
        EditOrganizationPermission(org).test()
        membership_request = self.get_or_404(org, id)
        form = api.validate(MembershipRefuseForm)
        membership_request.status = "refused"
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        membership_request.refusal_comment = form.comment.data

        org.save()

        notify_membership_response.delay(org, membership_request)

        return {}, 200
开发者ID:javanna2000,项目名称:udata,代码行数:15,代码来源:api.py

示例10: post

    def post(self, org, id):
        '''Accept user membership to a given organization.'''
        EditOrganizationPermission(org).test()
        membership_request = self.get_or_404(org, id)

        if org.is_member(membership_request.user):
            return org.member(membership_request.user), 409

        membership_request.status = 'accepted'
        membership_request.handled_by = current_user._get_current_object()
        membership_request.handled_on = datetime.now()
        member = Member(user=membership_request.user, role='editor')

        org.members.append(member)
        org.save()

        notify_membership_response.delay(org, membership_request)

        return member
开发者ID:opendatateam,项目名称:udata,代码行数:19,代码来源:api.py

示例11: accept_transfer

def accept_transfer(transfer, comment=None):
    '''Accept an incoming a transfer request'''
    TransferResponsePermission(transfer).test()

    transfer.responded = datetime.now()
    transfer.responder = current_user._get_current_object()
    transfer.status = 'accepted'
    transfer.response_comment = comment
    transfer.save()

    subject = transfer.subject
    recipient = transfer.recipient
    if isinstance(recipient, Organization):
        subject.organization = recipient
    elif isinstance(recipient, User):
        subject.owner = recipient

    subject.save()

    return transfer
开发者ID:odtvince,项目名称:udata,代码行数:20,代码来源:actions.py

示例12: on_user_deleted_dataset

def on_user_deleted_dataset(dataset):
    if (not dataset.private and current_user and
            current_user.is_authenticated):
        user = current_user._get_current_object()
        organization = dataset.organization
        write_activity.delay(UserDeletedDataset, user, dataset, organization)
开发者ID:michelbl,项目名称:udata,代码行数:6,代码来源:activities.py

示例13: is_following

def is_following(obj):
    return current_user.is_authenticated() and Follow.objects.is_following(current_user._get_current_object(), obj)
开发者ID:guillo-w,项目名称:udata,代码行数:2,代码来源:views.py

示例14: get

 def get(self):
     '''List all current user pending notifications'''
     user = current_user._get_current_object()
     return get_notifications(user)
开发者ID:anukat2015,项目名称:udata,代码行数:4,代码来源:api.py

示例15: inject_organization_needs

def inject_organization_needs(sender, identity):
    if current_user.is_authenticated():
        for org in Organization.objects(members__user=current_user.id):
            membership = get_by(org.members, 'user', current_user._get_current_object())
            identity.provides.add(OrganizationNeed(membership.role, org.id))
开发者ID:guillo-w,项目名称:udata,代码行数:5,代码来源:permissions.py


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