source: WAeUP_SRP/trunk/skins/waeup_utilities/getNonImageKeys.py @ 5458

Last change on this file since 5458 was 3991, checked in by Henrik Bettermann, 16 years ago

not used but useful

File size: 1.1 KB
Line 
1## Script (Python) "getNonImageKeys"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10
11info = context.waeup_tool.getAccessInfo(context)
12student_id = info['student_id']
13if student_id is None:
14    return None
15
16stool = context.portal_schemas
17ttool = context.portal_types
18#student_id = context.getStudentId()
19students_folder = context.portal_url.getPortalObject().campus.students
20student_obj = getattr(students_folder,student_id)
21student_subobject_ids = student_obj.objectIds()
22non_image_keys = {}
23for sub_obj_id in student_subobject_ids:
24    sub_obj = getattr(student_obj,sub_obj_id)
25    sub_pt = sub_obj.portal_type
26    pt_ob = getattr(ttool,sub_pt)
27    sub_schemas = pt_ob.schemas
28    for i in sub_schemas:
29        if i.startswith('student_'):
30            schema_id = i
31            schema = getattr(stool,schema_id)
32            non_image_keys[schema_id] = [key for key in schema.keys()
33                             if schema[key].meta_type != "CPS Image Field"]
34
35return non_image_keys   
36
37
Note: See TracBrowser for help on using the repository browser.