Here you can find information, how to update your old PyLucid Plugins (from v0.7.x to v0.8.x).

Some things has been changed, but many things works similar.

Examples of changes in a updated plugin:

update the internal pages

All internal pages are now stored into a sub directory named 'internal_pages'.

The django template engine is similar to the jinja engine. But some things works in a other way. First, you can use the update function:

  • Install the Plugin
  • run 'update to the new django template engine' in the _install section.
  • copy&paste the internal pages from the database into your files.

Then you can update in a try-error way. Look at these page:

The best way to change your internal page template: Edit the files and use the 'reinit' function in the Plugin Administration!

Plugins

  • definition:
    • There is no difference between "modules" and "plugins". There are no more "modules". Everything are named "plugins".
    • module_manager renamed to plugin_manager
  • new filesystem structure:
    • The directory "modules" and "builtin_plugins" are merged to "plugins_internal". The old "plugins" directory is renamed to "plugins_external".

config file

In the config file there are a few things changed:

  • In the 'internal_page_info' information, the key 'template_engine' deleted. Because we used only the django template engine.
  • rename 'module_manager_data' -> 'plugin_manager_data'
  • In the meta data thinks like "__important_buildin__" and "__essential_buildin__" removed.
  • New config setting: "__can_deinstall__". If this is False, the plugin can't be uninstalled. Default: True.

API

  • response/request
    • response and request object with subobjects changed.
    • Plugins should only write to self.response and return None. Other way: return a django httpresponse object (file download)
  • write internal pages
    • old: self.templates.write("sub_menu", context)
    • new: self._render_template("sub_menu", context)
Base class to inherit

PyLucid.system.BaseModule.PyLucidBaseModule -> PyLucid.system.BasePlugin.PyLucidBasePlugin
Now it works like this:

1
2
3
from PyLucid.system.BasePlugin import PyLucidBasePlugin

class MyPluginClass(PyLucidBasePlugin):
self.URLs

Many methods are deleted or renamed from this object:

  • commandLink(plugin_name, method_name, args=None)
  • 'actionLink' renamed to: methodLink(method_name, args=None)
  • adminLink(url)
database access

The own PyLucid database wrapper is gone a way. But that not a real problem. The django ORM is great! Please read the documentation about this here:

access to POST, GET data

old:

1
txt1 = self.request.form["txt1"]

new:

1
txt1 = self.request.POST["txt1"]

It is recommended to use newforms: http://www.djangoproject.com/documentation/newforms/

See also