Revision bf644f91 snf-astakos-app/astakos/im/register.py

b/snf-astakos-app/astakos/im/register.py
114 114
    return r, exists
115 115

  
116 116

  
117
def update_resources(updates):
118
    resources = []
119
    for resource, uplimit in updates:
120
        resources.append(resource)
121
        old_uplimit = resource.uplimit
122
        if uplimit == old_uplimit:
123
            logger.info("Resource %s has limit %s; no need to update."
124
                        % (resource.name, uplimit))
125
        else:
126
            resource.uplimit = uplimit
127
            resource.save()
128
            logger.info("Updated resource %s with limit %s."
129
                        % (resource.name, uplimit))
117
def update_base_default(resource, base_default):
118
    old_base_default = resource.uplimit
119
    if base_default == old_base_default:
120
        logger.info("Resource %s has base default %s; no need to update."
121
                    % (resource.name, base_default))
122
    else:
123
        resource.uplimit = base_default
124
        resource.save()
125
        logger.info("Updated resource %s with base default %s."
126
                    % (resource.name, base_default))
130 127

  
131 128

  
132 129
def resources_to_dict(resources):

Also available in: Unified diff