RFC: Patch for explicitly disallowing acquisition in UML model
Maurits van Rees <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
Can I have some comments on a small patch I just made for ArchGenXML?
Warning: this is lightly tested...
The idea here is to explicitly turn off acquisition of a permission by
adding a tagged value with the permission as tag and an empty value.
e.g. when you add a tag 'Review portal content' this would result in:
stateDef.setPermission('Review portal content',
0,
[])
Or did I miss something and is this already possible?
Or is it wrong/unnecessary to even want this? :)
#################
maurits@zandbak:~/az/zopeinstance/Products/ArchGenXML $ svn diff
Index: XMIParser.py
===================================================================
--- XMIParser.py (revision 5273)
+++ XMIParser.py (working copy)
@@ -2633,16 +2633,21 @@
for tag, tag_value in tagged_values.items():
# list of tagged values that are NOT permissions
- if tag in self.non_permissions or not tag_value:
+ if tag in self.non_permissions:
continue
tag = tag.strip()
# look up abbreviations if any
permission = permission_mapping.get(tag.lower(), tag)
+ acquisition = 0
+ if not tag_value:
+ permission_definitions.append({'permission' : permission,
+ 'roles' : [],
+ 'acquisition' : acquisition})
+ continue
# split roles-string into list
roles = [str(r.strip()) for r in tag_value.split(',') if
r.strip()]
# verify if this permission is acquired
nv = 'acquire'
- acquisition = 0
if nv in roles:
acquisition = 1
roles.remove(nv)
#################
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click