source: WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py @ 370

Last change on this file since 370 was 370, checked in by joachim, 18 years ago

allow entering and changing of ID's,

M profiles/default/vocabularies/courselevel.xml
A profiles/default/schemas/student_study_course.xml
M profiles/default/schemas/faculty.xml
M profiles/default/workflows.xml
M profiles/default/layouts/certificate.xml
M profiles/default/layouts/waeup_common.xml
A profiles/default/layouts/student_study_course.xml
M profiles/default/layouts/study_level.xml
M profiles/default/layouts/course.xml
M profiles/default/layouts/department.xml
M profiles/default/layouts/faculty.xml
M profiles/default/types/Certificate.xml
M profiles/default/types/Semester.xml
A profiles/default/types/StudentStudyCourse.xml
M profiles/default/types/StudyLevel.xml
M profiles/default/types/Course.xml
M profiles/default/types/CertificatesFolder.xml
M profiles/default/types/CertificateCourse.xml
M profiles/default/types/AcademicsFolder.xml
M profiles/default/types/Faculty.xml
M profiles/default/types/CoursesFolder.xml
A skins/waeup_default/id_rename_form.pt
A skins/waeup_default/id_rename.py
A skins/waeup_default/waeup_document_create_do.py
M skins/waeup_academics/academics_contents_display_buttons.py
M skins/waeup_academics/academics_contents.pt
M Academics.py

File size: 1.1 KB
Line 
1##parameters=type_name, datamodel
2# $Id: cpsdocument_create_do.py 34091 2006-03-06 18:37:08Z atchertchian $
3"""
4Create an empty object in the context according to the datamodel.
5
6Datamodel may be examined to create a suitable id.
7
8Returns the created object (usually a proxy).
9"""
10from Products.CMFCore.utils import getToolByName
11
12id = datamodel.get('code').upper()
13datamodel.set('code',id)
14##if not id:
15##    id = 'my ' + type_name
16##id = context.computeId(compute_from=id) # XXX shouldn't use a skin
17##
18language = datamodel.get('Language')
19if not language:
20    ts = getToolByName(context, 'translation_service')
21    language = ts.getSelectedLanguage()
22
23ttool = getToolByName(context, 'portal_types')
24ti = ttool[type_name]
25allow_discussion = ti.allowDiscussion()
26
27# Datamodel is passed so that flexti can initialize the object.
28new_id = context.invokeFactory(type_name, id, datamodel=datamodel,
29                               language=language,
30                               allow_discussion=allow_discussion)
31if new_id is not None:
32    id = new_id
33
34ob = getattr(context, id)
35
36context.notifyCPSDocumentCreation(ob=ob) # BBB obsolete in CPS 3.5.0
37
38return ob
Note: See TracBrowser for help on using the repository browser.