wiki:CodeCleanups

Version 12 (modified by Tim McNamara, 15 years ago) ( diff )

--

Haiti

Code Cleanups

  1. RepresentSafety
  2. crud_strings format

Move from the older, slow, more memory-hungry style:

title_create = T('Add Key')
title_display = T('Key Details')
title_list = T('List Keys')
title_update = T('Edit Key')
title_search = T('Search Keys')
subtitle_create = T('Add New Key')
subtitle_list = T('Keys')
label_list_button = T('List Keys')
label_create_button = T('Add Key')
msg_record_created = T('Key added')
msg_record_modified = T('Key updated')
msg_record_deleted = T('Key deleted')
msg_list_empty = T('No Keys currently defined')
s3.crud_strings[table] = Storage(title_create=title_create,title_display=title_display,title_list=title_list,title_update=title_update,title_search=title_search,subtitle_create=subtitle_create,subtitle_list=subtitle_list,label_list_button=label_list_button,label_create_button=label_create_button,msg_record_created=msg_record_created,msg_record_modified=msg_record_modified,msg_record_deleted=msg_record_deleted,msg_list_empty=msg_list_empty)

to the leaner, easier to read:

s3.crud_strings[table] = Storage(
    title_create = T('Add Hospital'),
    title_display = T('Hospital Details'),
    title_list = T('List Hospitals'),
    title_update = T('Edit Hospital'),
    title_search = T('Search Hospitals'),
    subtitle_create = T('Add New Hospital'),
    subtitle_list = T('Hospitals'),
    label_list_button = T('List Hospitals'),
    label_create_button = T('Add Hospital'),
    label_delete_button = T('Delete Hospital'),
    msg_record_created = T('Hospital information added'),
    msg_record_modified = T('Hospital information updated'),
    msg_record_deleted = T('Hospital information deleted'),
    msg_list_empty = T('No hospitals currently registered'))
  1. Rename controller functions which aren't user-facing (but called from other functions) as '_function_name'
  2. Replace all the T('unknown') with UNKNOWN_OPT (Which has now been set to T('unknown') at the top of 00_settings.py)

Status

Ticket lodged: http://trac.sahanapy.org/ticket/164

Done:

  • models/05_or.py
  • models/hms.py

Pending Approval: lp:~tim-clicks/sahana/haiti-minor

  • models/03_gis.py
  • models/msg.py
  • models/mpr.py
  • models/vol.py
  • controllers/gis.py

Haiti Haiti

Note: See TracWiki for help on using the wiki.