Show
Ignore:
Timestamp:
05/01/08 12:24:21 (23 months ago)
Author:
JensDiemer
Message:

put the plugin preferences into the plugin model.
TODO: update detect_page and set system_settings at install.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/db/preferences.py

    r1544 r1548  
    44    PyLucid preferences API 
    55    ~~~~~~~~~~~~~~~~~~~~~~~ 
     6 
     7    OBSOLETE 
    68 
    79    Last commit info: 
     
    168170 
    169171 
     172def get_pref_dict(plugin_name): 
     173    """ 
     174    returns the data_dict for the given plugin_name. Used the cache. 
     175    If a plugin use preferences in a newforms, it must have access to the 
     176    preferences at module level. 
     177    FIXME: If the admin change the preferences, the values in a plugin module 
     178    level would only updated, if the server instance restarted. 
     179    """ 
     180    if plugin_name in preference_cache: 
     181        return preference_cache[plugin_name] 
     182 
     183    plugin = Plugin.objects.get(plugin_name=plugin_name) 
     184 
     185    p = Preferences() 
     186    p.set_plugin(plugin) 
     187    p.load_from_db() 
     188    return p.data_dict 
     189 
    170190 
    171191#______________________________________________________________________________