Changeset 1030 for WAeUP_SRP/trunk


Ignore:
Timestamp:
11 Dec 2006, 18:12:23 (18 years ago)
Author:
joachim
Message:

made Widgets.py from Widgets_neu.py
corrected a syntax-error in Widgets.py
added some doubleclick error-checking in start_clearance (checked into Custom)
catch ConflictError? in PinTable?.
clearance_edit_form modified to catch anonymous access.
search_students.py + students_index.py actually unchanged.

Location:
WAeUP_SRP/trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTables.py

    r997 r1030  
    130130
    131131class PinTable(WAeUPTable):
    132 
     132    from ZODB.POSException import ConflictError
    133133    meta_type = 'WAeUP Pin Tool'
    134134    name = "pins"
     
    136136    def __init__(self):
    137137        WAeUPTable.__init__(self, 'portal_pins')
    138 
    139 
     138       
     139   
    140140    def searchAndSetRecord(self, uid, student_id,prefix):
    141141        #records = self.searchResults(uid=uid)
     
    159159            # Add the updated data:
    160160            record_data['student'] = student_id
    161             self.catalog_object(dict2ob(record_data), uid)
    162             return 1
     161            try:
     162                self.catalog_object(dict2ob(record_data), uid)
     163                return 1
     164            except ConflictError:
     165                return 2
    163166        if record.student.upper() != student_id.upper():
    164167            return 0
  • WAeUP_SRP/trunk/Widgets.py

    r1025 r1030  
    506506        s_id = str(self.portal_membership.getAuthenticatedMember())
    507507        if self.reference == "":
    508             ref = s_id 
     508            ref = s_id
    509509        else:
    510510            ref = datastructure[self.reference]
     
    512512                do = 0
    513513                datastructure.setError(widget_id, 'Errors in other data, PIN neither checked nor used.')
     514                s_logger.info('"%s", "%s","entered wrong data together with pin", "%s"' % (s_id,ref,pin))
    514515        while do:
    515516            ok = pins.searchAndSetRecord(pin,ref,prefix)
    516             if ok == -2:
     517            if ok < -2 or ok > 2:
     518                err = 'Unknown error, please report!'
     519                s_logger.info('"%s","%s", "caused unknown error with pin", "%s"' % (s_id,ref,pin))
     520                break
     521            elif ok == -2:
    517522                err = 'Service already activated but with a different PIN.'
     523                s_logger.info('"%s","%s", "repeatedly activated service but with different pin", "%s"' % (s_id,ref,pin))
    518524                break
    519525            elif ok == -1:
    520526                err = 'Invalid PIN'
    521                 break
    522             elif ok == -3:
    523                 err = 'Unknown error, please report!'
     527                s_logger.info('"%s","%s", "entered invalid pin", "%s"' % (s_id,ref,pin))
    524528                break
    525529            if ok == 0:
    526530                err = 'PIN already used.'
     531                s_logger.info('"%s","%s", "entered used pin", "%s"' % (s_id,ref,pin))
    527532                break
    528533            if ok >= 1:
     
    531536                    if self.reference == "jamb_reg_no":
    532537                        err = "You are already logged in."
    533                         s_logger.info('"%s", "logged in with pin", "%s"' % (ref,pin))
     538                        s_logger.info('"%s","%s", "checked admission though logged in", "%s"' % (s_id,ref,pin))
    534539                        break
    535                     s_logger.info('"%s", "used pin", "%s"' % (ref,pin))                #bitte genauer beschreiben
     540                    s_logger.info('"%s","%s", "successfully used pin", "%s"' % (s_id,ref,pin))
    536541                    break
    537542                else:
    538543                    student = getStudentByRegNo(self,ref)
    539                     s_logger.info('"jamb_reg_no:%s","used","%s"' % (ref,pin))         #bitte genauer beschreiben
     544                    s_logger.info('"%s","%s","successfully used pin","%s"' % (s_id,ref,pin))
    540545                if student is None:
    541546                    err = "Student not found."
     547                    s_logger.info('"%s","not found in admission list"' % (ref))
    542548                    break
    543549                s_id = student.getId()
     
    546552                        if hasattr(self.portal_directories.students,s_id):
    547553                            err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    548                             s_logger.info('"%s", "repeatedly checked admission with pin", "%s"' % (s_id,pin))      #ist das richtig?
     554                            s_logger.info('"%s","%s", "repeatedly checked admission with pin", "%s"' % (s_id,ref,pin))   
    549555                            break
    550556                        else:
    551                             s_logger.info('"%s","(non-member) repeatedly checked admission with pin",  "%s"' % (s_id,pin))     #ist das richtig?
     557                            s_logger.info('"%s","%s","(non-member) repeatedly checked admission with pin", "%s"' % (s_id,ref,pin))
    552558                    else:
    553                         err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    554                         s_logger.info('"%s", "repeatedly checked admission with pin", "%s"' % (s_id,pin))      #ist das richtig?
     559                        err = "Unknown error" % s_id
     560                        s_logger.info('"%s","%s", "repeatedly activated service with pin", "%s"' % (s_id,ref,pin))   
    555561                        break
    556 ##                if self.reference == "jamb_reg_no":
    557 ##                    res = self.students_catalog(jamb_reg_no = ref)
    558 ##                    if len(res) > 0:
    559 ##                        err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    560 ##                        s_logger.info("Student %s double checked Admission Pin %s" % (s_id,pin))
    561 ##                        break
    562562                try:
    563563                    student.getContent().makeStudentMember(s_id,password=pin[4:])
    564                     s_logger.info('"%s", "has been created using pin", "%s"' % (s_id,pin))
     564                    s_logger.info('"%s","%s", "has been created using pin", "%s"' % (s_id,ref,pin))
    565565                except:
    566566                    err = "Please login with your Student Id %s and 10-digit PIN." % s_id
    567                     s_logger.info('"%s", "has been repeatedly created usin pin", "%s"' % (s_id,ref))      #?????  bitte genauer beschreiben
     567                    s_logger.info('"%s","%s", "could not be made a member with pin", "%s"' % (s_id,ref,pin)) 
    568568                    break
    569569            break
  • WAeUP_SRP/trunk/skins/waeup_student/clearance_edit_form.pt

    r1014 r1030  
    11<metal:block define-macro="clearance_edit_form">
     2<metal:block tal:define="info context/getStudentInfo">
     3  <span tal:condition="not: info">
     4    <metal:block use-macro="here/error_not_found/macros/not_found" />
     5  </span>
     6<metal:block tal:condition="info">
    27<tal:block define="
    3            info context/getStudentInfo;
    48           is_so context/isSectionOfficer;
    59           is_staff context/isStaff;
     
    4650</tal:block>
    4751</metal:block>
     52</metal:block>
     53</metal:block>
  • WAeUP_SRP/trunk/skins/waeup_student/search_students_form.pt

    r1006 r1030  
    3535     
    3636        <span tal:replace="structure rendered" />
    37         <tal:block tal:condition="python: batch_info and batch_info['nb_pages'] > 1">
     37        <tal:block tal:condition="python: items and batch_info and batch_info['nb_pages'] > 1">
    3838          <div class="batchLayout">
    3939            <span i18n:translate="">
  • WAeUP_SRP/trunk/skins/waeup_student/start_clearance.py

    r1027 r1030  
    2323app_doc = info['app_doc']
    2424review_state = info['review_state']
    25 
     25session = REQUEST.SESSION
    2626res,psm,ds = lt.renderLayout(layout_id='student_clearance',
    2727                      schema_id= 'student_clearance',
     
    4141                                 )
    4242error = False
    43 if app_doc.passport is None:
     43if session.get("clicked",None):
     44    psm = 'Please wait a moment, until "Clearance started" turns green, then click on the green link'
     45    error = True
     46elif app_doc.passport is None:
    4447    psm = "You must upload your passport picture before you can start the registration process!"
    4548    error = True
     
    5760                                 ds = ds,
    5861                                 )
     62session.set("clicked","clicked")
    5963pin = str(ds.get('clr_ac_pin'))
    6064logger.info('"%s", "entered clearance pin", "%s"' % (info['id'],pin))
  • WAeUP_SRP/trunk/skins/waeup_student/students_index.py

    r937 r1030  
    2424
    2525if "ClearanceOfficers" in member.getGroups():
    26     return redirect("%s/search_students" % students_url)
     26    return context.waeup_tool.searchStudents()
     27    #return redirect("%s/search_students" % students_url)
    2728if context.isSectionOfficer():
    2829    return redirect("%s/search_students" % students_url)
Note: See TracChangeset for help on using the changeset viewer.