Changes between Version 4 and Version 5 of DeveloperGuidelines/Templates/Migration


Ignore:
Timestamp:
01/05/15 09:18:59 (7 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Templates/Migration

    v4 v5  
    2525== Refactoring config.py ==
    2626
    27 Re-structure config.py so that all settings-assignment are inside a function config() (see example below, or check modules/templates/skeleton/config.py).
    28 
    29 Do not assign any members of {{{current}}} to module-global variables (e.g. move "T = current.T" inside the config() function or wherever it is needed).
    30 
    31 Function and class definitions can (should) still be at the module level, not inside the config() function.
    32 
    33 Note that the variable "settings" is passed in as parameter for the config() function - so there is no need for "settings = current.deployment_settings". However, make sure that other functions in the template which depend on "settings" (or T) are fixed accordingly.
    34 
    35 Remember that the config.py module is no longer executed for every request (only the config() function still is). Move therefore any module-global lookups (especially those related to the logged-in user!) into callbacks, so that functions which depend on them operate with updated data and data don't leak across threads/sessions.
    36 
    37 The config() function returns nothing.
     27* Re-structure config.py so that all settings-assignment are inside a function config() (see example below, or check modules/templates/skeleton/config.py).
     28* Do not assign any members of {{{current}}} to module-global variables (e.g. move "T = current.T" inside the config() function or wherever it is needed).
     29* Function and class definitions can (should) still be at the module level, not inside the config() function.
     30* Note that the variable "settings" is passed in as parameter for the config() function - so there is no need for "settings = current.deployment_settings". However, make sure that other functions in the template which depend on "settings" (or T) are fixed accordingly.
     31* Remember that the config.py module is no longer executed for every request (only the config() function still is). Move therefore any module-global lookups (especially those related to the logged-in user!) into callbacks, so that functions which depend on them operate with updated data and data don't leak across threads/sessions.
     32* The config() function returns nothing.
    3833
    3934Old config.py: