Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

Exports for the betahaus.openmember

Project description

Introduction

Extension package for betahaus.openmember that exports searches and full database to CVS. It is also has support for registering own exporters.

Extensions

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:

>>> registerExporter(IExportContactsAdapter)

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.

Changelog

0.1b2 (2010-04-16)

  • Fixed bug with full database csv export. [mlundwall]
  • Updated the loading of exporters from the action. [mlundwall]

0.1b (2010-02-10)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
betahaus.exports.openmember-0.1b2.zip (27.6 kB) Copy SHA256 hash SHA256 Source None Apr 16, 2010

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page