Skip to content

Instantly share code, notes, and snippets.

@johnwesonga
Created January 20, 2015 11:11
Show Gist options
  • Save johnwesonga/a54fff815f9e30477713 to your computer and use it in GitHub Desktop.
Save johnwesonga/a54fff815f9e30477713 to your computer and use it in GitHub Desktop.
Shitty Python Code
if view == 'student_details':
reg_no = self.request.get('regno',None)
period = self.request.get('period',None)
#Verify Email address and registration number
email = users.get_current_user().email()
if ops.verifyUser(email, reg_no) or ops.isSuperAdmin(users.get_current_user().email()):
pass
else:
self.redirect('/unauthorized')
values['student_details'] = ops.getStudent(reg_no,period)
if len(values['student_details']) > 0:
wireframe = 'student_details'
else:
wireframe = 'record_notfound'
values['regno'] = reg_no
elif view == 'application_first':
if ops.hasApplied(email):
message = 'You have already applied! You can only apply once!'
values['message'] = message
wireframe = 'report'
elif ops.allocated(email):
message = 'You have already been allocated hostel! You can not apply again!'
values['message'] = message
wireframe = 'report'
else:
wireframe = 'application_first'
elif view == 'application_cont':
if ops.hasApplied(email):
message = 'You have already applied! You can only apply once!'
values['message'] = message
wireframe = 'report'
elif ops.allocated(email):
message = 'You have already been allocated hostel! You can not apply again!'
values['message'] = message
wireframe = 'report'
else:
wireframe = 'application_cont'
elif view == 'status':
periods = ops.getPeriods()
values['periods'] = periods
wireframe = 'status'
elif view == 'unauthorized':
wireframe = 'unauthorized'
values['isAuthorised'] = False
elif view == 'openApp':
ops.openApplication()
wireframe = 'report'
message = 'Hostel Applications are Open!'
elif view == 'allowReApp':
ops.allowReApplication()
wireframe = 'report'
message = 'You have allowed hostel Reapplication'
elif view == 'disAllowReApp':
ops.disAllowReApp()
wireframe = 'report'
message = 'You have disallowed hostel Re-Application'
if ops.reAppIsOpen():
values['statusMessage'] = 'Reapplication Open'
else:
values['statusMessage'] = 'No Reapplication'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment