Changeset 7145


Ignore:
Timestamp:
19 Nov 2011, 17:56:03 (13 years ago)
Author:
Henrik Bettermann
Message:

Change some function names according to the style guide:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Location:
main
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.custom/trunk/src/waeup/custom/interfaces.py

    r7021 r7145  
    1111
    1212    school_fee_base = schema.Int(
    13         title = u'School Fee',
     13        title = u'School Fee (ignored)',
    1414        default = 0,
    1515        )
  • main/waeup.custom/trunk/src/waeup/custom/students/browser.py

    r6948 r7145  
    33from zope.component import createObject
    44from waeup.sirp.students.browser import OnlinePaymentAddFormPage
    5 from waeup.custom.students.utils import getPaymentDetails
     5from waeup.custom.students.utils import get_payment_details
    66
    77class OnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
     
    99    """
    1010
    11     def getPaymentDetails(self, category, student):
    12         return getPaymentDetails(category, student)
     11    def get_payment_details(self, category, student):
     12        return get_payment_details(category, student)
  • main/waeup.custom/trunk/src/waeup/custom/students/utils.py

    r7021 r7145  
    33from waeup.sirp.students.workflow import CLEARED, RETURNING
    44
    5 def getPaymentDetails(category, student):
     5def get_payment_details(category, student):
    66    d = {}
    77    d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py

    r7136 r7145  
    797797    title = u'Your Application Form'
    798798
    799     def emitLockMessage(self):
     799    def emit_lock_message(self):
    800800        self.flash('The requested form is locked (read-only).')
    801801        self.redirect(self.url(self.context))
     
    804804    def update(self):
    805805        if self.context.locked:
    806             self.emitLockMessage()
     806            self.emit_lock_message()
    807807            return
    808808        datepicker.need() # Enable jQuery datepicker in date fields.
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7144 r7145  
    5252from waeup.sirp.students.vocabularies import StudyLevelSource
    5353from waeup.sirp.students.utils import (
    54     getPaymentDetails, getAccommodationDetails, selectBed,
    55     renderPDF, validatePassword)
     54    get_payment_details, get_accommodation_details, select_bed,
     55    render_pdf, validatePassword)
    5656from waeup.sirp.browser.resources import toggleall
    5757from waeup.sirp.authentication import get_principal_role_manager
     
    7777    return
    7878
    79 def emitLockMessage(view):
     79def emit_lock_message(view):
    8080    view.flash('The requested form is locked (read-only).')
    8181    view.redirect(view.url(view.context))
     
    678678        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
    679679            self.request)
    680         return renderPDF(self,'Course Registration', 'course_registration.pdf',
     680        return render_pdf(self,'Course Registration', 'course_registration.pdf',
    681681            self.context.getStudent, studentview)
    682682
     
    951951   
    952952    # To be sepezified in customization packages
    953     def getPaymentDetails(self, category, student):
    954         return getPaymentDetails(category, student)
     953    def get_payment_details(self, category, student):
     954        return get_payment_details(category, student)
    955955
    956956    @grok.action('Create ticket')
     
    965965                self.redirect(self.url(self.context))
    966966                return
    967         pay_details  = self.getPaymentDetails(
     967        pay_details  = self.get_payment_details(
    968968            p_category,student)
    969969        if pay_details['error']:
     
    11191119        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
    11201120            self.request)
    1121         return renderPDF(self,'Payment', 'payment_receipt.pdf',
     1121        return render_pdf(self,'Payment', 'payment_receipt.pdf',
    11221122            self.context.getStudent, studentview)
    11231123
     
    12291229
    12301230    # To be sepezified in customization packages
    1231     def getAccommodationDetails(self, student):
    1232         return getAccommodationDetails(student)
     1231    def get_accommodation_details(self, student):
     1232        return get_accommodation_details(student)
    12331233
    12341234    # To be sepezified in customization packages
    1235     def selectBed(self, available_beds):
    1236         return selectBed(available_beds)
     1235    def select_bed(self, available_beds):
     1236        return select_bed(available_beds)
    12371237
    12381238    def update(self, SUBMIT=None):
    12391239        student = self.context.getStudent()
    1240         acc_details  = self.getAccommodationDetails(student)
     1240        acc_details  = self.get_accommodation_details(student)
    12411241        if not student.state in acc_details['allowed_states']:
    12421242            self.flash("You are in the wrong registration state.")
     
    12751275                entry for entry in entries if entry.owner == NOT_OCCUPIED]
    12761276            if available_beds:
    1277                 bed = self.selectBed(available_beds)
     1277                bed = self.select_bed(available_beds)
    12781278                bed.bookBed(student.student_id)
    12791279            else:
     
    13561356        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
    13571357            self.request)
    1358         return renderPDF(self,'Bed Allocation', 'bed_allocation.pdf',
     1358        return render_pdf(self,'Bed Allocation', 'bed_allocation.pdf',
    13591359            self.context.getStudent, studentview)
    13601360
     
    13761376
    13771377    # To be sepezified in customization packages
    1378     def getAccommodationDetails(self, student):
    1379         return getAccommodationDetails(student)
     1378    def get_accommodation_details(self, student):
     1379        return get_accommodation_details(student)
    13801380
    13811381    # To be sepezified in customization packages
    1382     def selectBed(self, available_beds):
    1383         return selectBed(available_beds)
     1382    def select_bed(self, available_beds):
     1383        return select_bed(available_beds)
    13841384
    13851385    # Relocate student if student parameters have changed or the bed_type
     
    13871387    def update(self):
    13881388        student = self.context.getStudent()
    1389         acc_details  = self.getAccommodationDetails(student)
     1389        acc_details  = self.get_accommodation_details(student)
    13901390        if self.context.bed != None and \
    13911391              'reserved' in self.context.bed.bed_type:
     
    14141414                entry for entry in entries if entry.owner == NOT_OCCUPIED]
    14151415            if available_beds:
    1416                 new_bed = self.selectBed(available_beds)
     1416                new_bed = self.select_bed(available_beds)
    14171417                new_bed.bookBed(student.student_id)
    14181418            else:
     
    15481548    def update(self):
    15491549        if self.context.getStudent().state != 'admitted':
    1550             emitLockMessage(self)
     1550            emit_lock_message(self)
    15511551            return
    15521552        super(StudentFilesUploadPage, self).update()
     
    16621662    def update(self):
    16631663        if self.context.clearance_locked:
    1664             emitLockMessage(self)
     1664            emit_lock_message(self)
    16651665            return
    16661666        return super(StudentClearanceEditFormPage, self).update()
     
    18191819    def update(self):
    18201820        if self.context.getStudent().state != 'school fee paid':
    1821             emitLockMessage(self)
     1821            emit_lock_message(self)
    18221822            return
    18231823        super(AddStudyLevelFormPage, self).update()
  • main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py

    r7144 r7145  
    4141# To be specified in customization packages, see also the view which
    4242# calls the function.
    43 def getPaymentDetails(category, student):
     43def get_payment_details(category, student):
    4444    d = {}
    4545    d['p_item'] = u''
     
    6363        d['amount'] = academic_session.clearance_fee
    6464    elif category == 'bed_allocation':
    65         d['p_item'] = getAccommodationDetails(student)['bt']
     65        d['p_item'] = get_accommodation_details(student)['bt']
    6666        d['amount'] = academic_session.booking_fee
    6767    return d
     
    6969# To be specified in customization packages, see also the view which
    7070# calls the function.
    71 def getAccommodationDetails(student):
     71def get_accommodation_details(student):
    7272    d = {}
    7373    d['error'] = u''
     
    9999# I the standard configuration we select the first bed found,
    100100# but can also randomize the selection if we like.
    101 def selectBed(available_beds):
     101def select_bed(available_beds):
    102102    return available_beds[0]
    103103
     
    110110        )
    111111
    112 def renderStudentData(student, studentview):
     112def render_student_data(student, studentview):
    113113    setUpWidgets(studentview, ignore_request=True)
    114114    data = []
     
    127127# To be specified in customization packages, see also view which
    128128# calls the function.
    129 def renderPDF(view, subject='', filename='slip.pdf', student=None, studentview=None):
     129def render_pdf(view, subject='', filename='slip.pdf', student=None, studentview=None):
    130130    # (0,0),(-1,-1) = whole table
    131131    # (0,0),(0,-1) = first column
     
    156156    if student:
    157157        story.append(Spacer(1, 18))
    158         studenttable = renderStudentData(student, studentview)
     158        studenttable = render_student_data(student, studentview)
    159159        story.append(studenttable)
    160160    story.append(Spacer(1, 18))
Note: See TracChangeset for help on using the changeset viewer.