Exports for the betahaus.openmember
Extension package for betahaus.openmember that exports searches and full database to CVS. It is also has support for registering own exporters.
It is possible to extend with custom exporters. You need one Adapter and a browser view
The adapter is created by making a interface that inherits from the betahaus.exports.openmember.interfaces.IExporter interface.
>>> from betahaus.exports.openmember.interfaces import IExporter >>> class IExportCustomAdapter(IExporter): ... """ Interface for registering custom exporter"""
With code that implements the adapter interface.
>>> from betahaus.exports.openmember.browser.export import make_url >>> class ExportCustomAdapter(object): ... """Another exporter""" ... implements(IExportCustomAdapter) ... adapts(IExportable) ... ... def __init__(self, context): ... self.context = context ... ... def url(self): ... return '%s/custom_exporter%s' % (self.context.portal_url(), make_url(self.context.request)) ... ... def Title(self): ... return _('Custom Export from table')
This then needs to be registered as a exporter by calling:
We also needs some zcml to register the adapter, since everything is defined in the adapter the only thing we need is:
<adapter factory=”.export.ExportCustomAdapter” />
Assuming that the file is called export.py
Now we only need a browser view to handle the exporting
>>> from betahaus.exports.openmember.browser.export import ExportBase >>> class ExportCustom(ExportBase): ... """Download as csv""" ... ... def __call__(self): ... # here you can do the changes that you need to do for your custom exporter.
Look at ExportBase for more information about what functions are available.
- Fixed bug with full database csv export. [mlundwall]
- Updated the loading of exporters from the action. [mlundwall]
- Initial release
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size betahaus.exports.openmember-0.1b2.zip (27.6 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for betahaus.exports.openmember-0.1b2.zip