Changeset 3033
- Timestamp:
- 22 Jan 2008, 21:00:09 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r3027 r3033 1921 1921 ###) 1922 1922 1923 security.declareProtected(ModifyPortalContent,'mass_edit_verdict') ###( 1924 def mass_edit_verdict(self,mapping): 1925 wftool = self.portal_workflow 1926 "edit a students verdict" 1927 logger = logging.getLogger('WAeUPTool.mass_edit_verdict') 1928 students_folder = self.portal_url.getPortalObject().campus.students 1929 student_id = mapping.get('id',None) 1930 matric_no = mapping.get('matric_no',None) 1931 editable_keys = mapping.keys() 1932 if student_id: 1933 student_record = self.students_catalog.getRecordById(student_id) 1934 if student_record is None: 1935 return '',"no student with id %s" % student_id 1936 if matric_no and student_record.matric_no and\ 1937 matric_no != student_record.matric_no: 1938 logger.info("%s, old matric_no %s overwritten with %s" % (student_record.id,student_record.matric_no,matric_no)) 1939 elif matric_no: 1940 res = self.students_catalog(matric_no = matric_no) 1941 if not res: 1942 return '',"no student with matric_no %s" % matric_no 1943 student_record = res[0] 1944 editable_keys.remove('matric_no') 1945 1946 student_id = student_record.id 1947 student_review_state = student_record.review_state 1948 if student_review_state not in ('courses_validated',): 1949 return '',"student %s in wrong review_state %s" % (student_id, student_review_state) 1950 student_obj = getattr(students_folder,student_id) 1951 f2t = self.field2types_student 1952 d = {} 1953 #import pdb;pdb.set_trace() 1954 any_change = False 1955 #special treatment for StudentStudyLevel 1956 current_session = mapping.get('current_session','') 1957 if current_session and student_record.session != current_session: 1958 return '','student_id: %s imported session %s does not match session %s' % (student_id, 1959 current_session, 1960 student_record.session) 1961 1962 current_level = mapping.get('current_level','') 1963 if current_level and student_record.level != current_level: 1964 return '','student_id %s: imported level %s does not match level %s' % (student_id, 1965 current_level, 1966 student_record.level) 1967 sub_obj = getattr(student_obj,'study_course',None) 1968 if sub_obj is None: 1969 return '','student_id %s: no study_course-object' % student_id 1970 level_obj = getattr(sub_obj,current_level,None) 1971 if level_obj is None: 1972 return '','student_id %s: no study_level-object for level %s' % (student_id, 1973 current_level) 1974 verdict = d['verdict'] = mapping.get('current_verdict','') 1975 if verdict == student_record.verdict: 1976 return '','student_id %s: verdict already set to %s' % (student_id, 1977 verdict) 1978 1979 level_review_state = wftool.getInfoFor(level_obj,'review_state',None) 1980 if level_review_state != "closed": 1981 return '','student_id %s: level %s is not closed' % (student_id, 1982 current_level) 1983 1984 level_obj.getContent().edit(mapping = d) 1985 try: 1986 wftool.doActionFor(level_obj,'close') 1987 except: 1988 pass 1989 return student_id,'' 1990 ###) 1991 1923 1992 security.declareProtected(ModifyPortalContent,"importData")###( 1924 1993 def importData(self,filename,name,edit=False,bypass_queue_catalog=False): … … 1983 2052 logger.info('%s starts import from %s.csv in %s mode with schema and layout %s' % (member,filename,mode,iname)) 1984 2053 attrs = csv.reader(open("%s/import/%s.csv" % (i_home,filename),"rb")).next() 1985 import_keys = [k.strip() for k in attrs if not k.st artswith('ignore')]2054 import_keys = [k.strip() for k in attrs if not k.strip().startswith('ignore')] 1986 2055 diff2schema = set(import_keys).difference(set(schema.keys())) 1987 2056 diff2layout = set(import_keys).difference(set(layout.keys())) -
WAeUP_SRP/uniben/profiles/default/layouts.xml
r2743 r3033 24 24 <object name="import_application" meta_type="CPS Layout"/> 25 25 <object name="import_faculty" meta_type="CPS Layout"/> 26 <object name="import_verdict" meta_type="CPS Layout"/> 26 27 27 28 <object name="department" meta_type="CPS Layout"/> -
WAeUP_SRP/uniben/profiles/default/schemas.xml
r2517 r3033 20 20 <object name="import_student_level_data" meta_type="CPS Schema"/> 21 21 <object name="import_student_course_results" meta_type="CPS Schema"/> 22 <object name="import_verdict" meta_type="CPS Schema"/> 22 23 23 24 <object name="course" meta_type="CPS Schema"/> -
WAeUP_SRP/uniben/profiles/default/vocabularies/import_names.xml
r2517 r3033 14 14 <item key="certificate_course" msgid="">Certificate Course Data</item> 15 15 <item key="application" msgid="">Application Data</item> 16 <item key="verdict" msgid="">Verdicts</item> 16 17 </object>
Note: See TracChangeset for help on using the changeset viewer.