Rev | Line | |
---|
[3991] | 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 |
|
---|
| 11 | info = context.waeup_tool.getAccessInfo(context)
|
---|
| 12 | student_id = info['student_id']
|
---|
| 13 | if student_id is None:
|
---|
| 14 | return None
|
---|
| 15 |
|
---|
| 16 | stool = context.portal_schemas
|
---|
| 17 | ttool = context.portal_types
|
---|
| 18 | #student_id = context.getStudentId()
|
---|
| 19 | students_folder = context.portal_url.getPortalObject().campus.students
|
---|
| 20 | student_obj = getattr(students_folder,student_id)
|
---|
| 21 | student_subobject_ids = student_obj.objectIds()
|
---|
| 22 | non_image_keys = {}
|
---|
| 23 | for 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 |
|
---|
| 35 | return non_image_keys
|
---|
| 36 |
|
---|
| 37 |
|
---|
Note: See
TracBrowser for help on using the repository browser.