'Export POI resources.
URL options:
- "resources"   list of tablenames to export records from
- "msince"      datetime in ISO format, "auto" to use the
feed\'s last update
- "update_feed" 0 to skip the update of the feed\'s last
update datetime, useful for trial exports
Supported formats:
.xml            S3XML
.osm            OSM XML Format
.kml            Google KML
(other formats can be requested, but may give unexpected results)
@param r: the S3Request
@param attr: controller options for this request'

def export(self, r, **attr):

    current_lx = r.record
    if (not current_lx):
        r.error(400, current.ERROR.BAD_REQUEST)
    else:
        self.lx = current_lx.id
    tables = []
    if ('resources' in r.get_vars):
        resources = r.get_vars['resources']
    else:
        resources = current.deployment_settings.get_gis_poi_export_resources()
    if (not isinstance(resources, list)):
        resources = [resources]
    [tables.extend(t.split(',')) for t in resources]
    update_feed = True
    if ('update_feed' in r.get_vars):
        _update_feed = r.get_vars['update_feed']
        if (_update_feed == '0'):
            update_feed = False
    msince = None
    if ('msince' in r.get_vars):
        msince = r.get_vars['msince']
        if (msince.lower() == 'auto'):
            msince = 'auto'
        else:
            msince = s3_parse_datetime(msince)
    tree = self.export_combined_tree(tables, msince=msince, update_feed=update_feed)
    xml = current.xml
    response = current.response
    s3 = response.s3
    headers = response.headers
    representation = r.representation
    if (r.representation in s3.json_formats):
        as_json = True
        default = 'application/json'
    else:
        as_json = False
        default = 'text/xml'
    headers['Content-Type'] = s3.content_type.get(representation, default)
    stylesheet = r.stylesheet()
    if (tree and (stylesheet is not None)):
        args = Storage(domain=xml.domain, base_url=s3.base_url, utcnow=s3_format_datetime())
        tree = xml.transform(tree, stylesheet, **args)
    if tree:
        if as_json:
            output = xml.tree2json(tree, pretty_print=True)
        else:
            output = xml.tostring(tree, pretty_print=True)
    return output
