Пример #1
0
def update_smf_groups(self, pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating smf groups for user %s" % user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for group in user.groups.all():
        groups.append(str(group.name))
    if len(groups) == 0:
        groups.append('empty')
    logger.debug("Updating user %s smf groups to %s" % (user, groups))
    try:
        smfManager.update_groups(authserviceinfo.smf_username, groups)
    except:
        logger.exception("smf group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown=60 * 10)
    logger.debug("Updated user %s smf groups." % user)
Пример #2
0
def update_smf_groups(self, pk):
    user = User.objects.get(pk=pk)
    logger.debug("Updating smf groups for user %s" % user)
    authserviceinfo = AuthServicesInfo.objects.get(user=user)
    groups = []
    for group in user.groups.all():
        groups.append(str(group.name))
    if len(groups) == 0:
        groups.append('empty')
    logger.debug("Updating user %s smf groups to %s" % (user, groups))
    try:
        smfManager.update_groups(authserviceinfo.smf_username, groups)
    except:
        logger.exception("smf group sync failed for %s, retrying in 10 mins" % user)
        raise self.retry(countdown=60 * 10)
    logger.debug("Updated user %s smf groups." % user)