Changeset 1452 in products for quintagroup.transmogrifier/branches
- Timestamp:
- Dec 8, 2009 10:52:48 AM (14 years ago)
- Location:
- quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier
- Property svn:mergeinfo changed from /quintagroup.transmogrifier/trunk:1447-1448 to /quintagroup.transmogrifier/trunk:1447-1448,1451
-
quintagroup.transmogrifier/branches/plone-2.1/quintagroup.transmogrifier/quintagroup/transmogrifier/namespaces/cmfns.py
r1413 r1452 14 14 15 15 def processXml(self, context, node): 16 tag, namespace = utils.fixtag(node.tag,context.ns_map)17 16 nsprefix = node.tag[:node.tag.find('}')+1] 18 17 local_roles = node.findall(nsprefix+self.name) … … 28 27 29 28 return True 29 30 class WorkflowAttribute(base.WorkflowAttribute): 30 31 32 def processXml(self, context, node): 33 data = context.getDataFor(self.namespace.xmlns) 34 wf_data = data.setdefault(self.name, {}) 35 nsprefix = node.tag[:node.tag.find('}')+1] 36 37 for wf_node in node.findall(nsprefix+'workflow'): 38 # workflow 39 wf_id = wf_node.attrib.get(nsprefix+'id') or \ 40 wf_node.attrib.get('id') 41 if wf_id is None: 42 continue 43 44 # history 45 wf = wf_data.setdefault(wf_id, []) 46 hist_nodes = wf_node.findall(nsprefix+'history') 47 for hist_node in hist_nodes: 48 record = {} 49 wf.append(record) 50 51 #var 52 var_nodes = hist_node.findall(nsprefix+'var') 53 vid = vtype = value = None 54 55 for var_node in var_nodes: 56 vid = var_node.attrib.get(nsprefix+'id') or \ 57 var_node.attrib.get('id') 58 vtype = var_node.attrib.get(nsprefix+'type',None) or \ 59 var_node.attrib.get('type') 60 value = var_node.attrib.get(nsprefix+'value',None) or \ 61 var_node.attrib.get('value') or '' 62 63 if not (vid and vtype and value is not None): 64 continue 65 66 value = base.demarshall_value(value, vtype) 67 record[vid] = value 68 69 return True 70 31 71 class CMF(base.CMF): 32 72 33 73 attributes = ( 34 74 base.TypeAttribute('type'), 35 base.WorkflowAttribute('workflow_history'),75 WorkflowAttribute('workflow_history'), 36 76 LocalRolesAttribute('local_role') 37 77 )
Note: See TracChangeset
for help on using the changeset viewer.