Changeset 3301 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
9 Mar 2008, 22:30:59 (17 years ago)
Author:
Henrik Bettermann
Message:

request.RESPONSE.redirect without return doesn't make sense

minor changes in workflow

Location:
WAeUP_SRP/base/skins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_default/waeup_edit.py

    r2042 r3301  
    22# $Id: external_edit.py 805 2006-11-09 09:38:29Z joachim $
    33"""
    4 Called when a document form is posted.
    5 
    6 Validates data, then:
    7 
    8  - if there's no error, updates the object and redirects to it,
    9 
    10  - if there's an error, puts data in session and redirects to edit form.
    11 
    12 A form uid is propagated during the redirect to uniquely identify the
    13 form in the session.
    144"""
    155
     
    2414mtool = context.portal_membership
    2515member = mtool.getAuthenticatedMember()
     16doc = context.getContent()
    2617
    27 # Check flexible controls
    28 #context.editLayouts(REQUEST=REQUEST)
    29 
    30 # Validate the document and write it if it's valid
    31 # (We don't call getEditableContent here, validate does it when needed.)
    32 doc = context.getContent()
    33 if context.portal_type == "StudentStudyCourse":
    34     if len(context.objectIds()) > 0:
    35         psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!'
    36         args = getFormUidUrlArg(REQUEST)
    37         args['portal_status_message'] = psm
    38         url = context.absolute_url() + '?' + urlencode(args)
    39         REQUEST.RESPONSE.redirect(url)
     18#if context.portal_type == "StudentStudyCourse":
     19#    if len(context.objectIds()) > 0:
     20#        psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!'
     21#        args = getFormUidUrlArg(REQUEST)
     22#        args['portal_status_message'] = psm
     23#        url = context.absolute_url() + '?' + urlencode(args)
     24#        return REQUEST.RESPONSE.redirect(url)
    4025
    4126is_valid, ds = doc.validate(request=REQUEST, proxy=context, cluster=cluster,
     
    4429student_id = context.getStudentId()
    4530
    46 ##if action is None:
    47 ##    ti = doc.getTypeInfo()
    48 ##    action = ti.queryMethodID('edit', 'external_edit_form')
    49 ##    action = '/' + action
    50 
    5131action = "/" + came_from
    5232if is_valid:
     
    5434    context.cpsdocument_notify_modification(comments=comments)
    5535
    56     ###################################################
    57     if False:
    58         if context.portal_type == "StudentStudyCourse":
    59             course = ds.get('study_course')
    60             #student_id = context.getStudentId()
    61             res = context.portal_catalog(portal_type='Certificate',id = course)
    62             if res:
    63                 c_brain = res[0]
    64                 c_path = c_brain.getPath().split('/')
    65                 #student_id = context.getStudentId()
    66                 context.students_catalog.modifyRecord(id = student_id,
    67                                                       course = course,
    68                                                       level = ds.get('current_level'),
    69                                                       verdict = ds.get('current_verdict'),
    70                                                       faculty = c_path[-4],
    71                                                       department = c_path[-3],
    72                                                       )
    73                 logger.info('%s edited %s (%s) of %s' % (member,context.id,course,student_id))
    74 
    75         elif context.portal_type == "StudentApplication": # disabled
    76             entry_mode = ds.get('entry_mode')
    77             #student_id = context.getStudentId()
    78             context.students_catalog.modifyRecord(id = student_id,
    79                                                   entry_mode = entry_mode,
    80                                                  )
    81             logger.info('%s edited %s of %s' % (member,context.id,student_id))
    82         elif context.portal_type == "StudentClearance":
    83             matric_no = ds.get('matric_no')
    84             #student_id = context.getStudentId()
    85             context.students_catalog.modifyRecord(id = student_id,
    86                                                   matric_no = matric_no,
    87                                                  )
    88             logger.info('%s edited %s of %s' % (member,context.id,student_id))
    89         elif context.portal_type in ("StudentPersonal",):
    90             name = "%(firstname)s %(middlename)s %(lastname)s" % ds
    91             name = name.strip()
    92             name = name.replace('  ',' ')
    93             email = ds.get('email')
    94             phone = ds.get('phone')
    95             #student_id = context.getStudentId()
    96             #app_doc = context.application.getContent()
    97             #jamb_sex = 'M'
    98             #if ds.get('sex'):
    99             #    jamb_sex = 'F'
    100             # originally imported data must be kept; app_doc should not be changed here
    101             #app_doc.edit(mapping={'jamb_lastname': name,
    102             #                      'jamb_sex': jamb_sex
    103             #                      })
    104             context.students_catalog.modifyRecord(id = student_id,
    105                                                   name = name,
    106                                                   email = email,
    107                                                   phone = phone,
    108                                                   sex = ds.get('sex'),
    109                                                  )
    110             logger.info('%s edited %s of %s' % (member,context.id,student_id))
    111         elif context.portal_type == "xxxxCourse": # disabled handled by events
    112             dd = {}
    113             dd.update(ds) # ds is not a real dictionary
    114             try:
    115                 context.courses_catalog.modifyRecord(**dd)
    116             except KeyError:
    117                 context.courses_catalog.addRecord(**dd)
    118     ###################################################
    11936
    12037
  • WAeUP_SRP/base/skins/waeup_upload/uploads_index.py

    r3297 r3301  
    3535info['doc'] = context.getContent()
    3636
     37logger.info('%s views upload section' % member)
     38
    3739edit = request.form.has_key('edit')
    3840ids = request.get('ids',[])
     
    5759            for key in new_keys:
    5860                logger.info('%s changed column heading in file %s from %s to %s' % (member,long_id,key[0],key[1]))
    59         request.RESPONSE.redirect(context.absolute_url())
    60 
     61       
    6162wrong = []
    6263imported = []
     
    138139d['url'] = upload.absolute_url()
    139140upload.getContent().edit(mapping=d)
    140 logger.info('%s uploaded file %s in layout mode %s' % (member,filename,d['import_layout']))
     141logger.info('%s uploaded file %s with import layout %s' % (member,filename,d['import_layout']))
    141142
    142 request.RESPONSE.redirect(context.absolute_url())
     143return request.RESPONSE.redirect(context.absolute_url())
    143144
Note: See TracChangeset for help on using the changeset viewer.