allura
Révision | a3ab5407b549c59559b5b9b6a16066be2015c7ba (tree) |
---|---|
l'heure | 2011-04-28 23:48:33 |
Auteur | Dave Brondsema <dbrondsema@geek...> |
Commiter | Dave Brondsema |
[#1909] more resilient to already converted data
Signed-off-by: Dave Brondsema <dbrondsema@geek.net>
@@ -84,6 +84,10 @@ def update_project_acl(project_doc): | ||
84 | 84 | |
85 | 85 | def update_neighborhood_acl(neighborhood_doc, init_doc): |
86 | 86 | '''Convert nbhd admins users to --init-- project admins''' |
87 | + if 'acl' not in neighborhood_doc: | |
88 | + log.warning('Neighborhood %s is already updated' % neighborhood_doc['name']) | |
89 | + return | |
90 | + | |
87 | 91 | if TEST: log.info('Update nbhd %s', neighborhood_doc['name']) |
88 | 92 | if 'acl' not in neighborhood_doc: |
89 | 93 | log.warning('Neighborhood %s already updated', neighborhood_doc['name']) |
@@ -112,6 +116,10 @@ def update_neighborhood_acl(neighborhood_doc, init_doc): | ||
112 | 116 | |
113 | 117 | def simple_acl_update(doc): |
114 | 118 | '''Update dict-style to list-style ACL''' |
119 | + if not isinstance(doc['acl'], dict): | |
120 | + log.warning('Already upgraded %s' % doc) | |
121 | + return | |
122 | + | |
115 | 123 | new_acl = [] |
116 | 124 | for perm, role_ids in sorted(doc['acl'].iteritems()): |
117 | 125 | for rid in role_ids: |