Last active
December 21, 2015 19:39
-
-
Save jensens/6356051 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from plone.app.querystring.queryparser import getPathByUID, getNavigationRoot | |
def _multi_path(context, row): | |
values = [] | |
for value in row.values.split(): | |
if not '/' in value: | |
# It must be a UID | |
value = '/'.join(getPathByUID(context, value)) | |
# take care of absolute paths without nav_root | |
nav_root = getNavigationRoot(context) | |
if not value.startswith(nav_root): | |
value = nav_root + value | |
values.append(value) | |
tmp = {row.index: {'query': values, }} | |
print tmp | |
return tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Operation Definitions --> | |
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n" | |
i18n:domain="plone"> | |
<records interface="plone.app.querystring.interfaces.IQueryOperation" | |
prefix="plone.app.querystring.operation.string.multiPath"> | |
<value key="title" i18n:translate="">Multiple absolute paths</value> | |
<value key="description" i18n:translate="">One or more location in the site structure</value> | |
<value key="operation">kup.eca.site.querystring._multi_path</value> | |
<value key="widget">StringWidget</value> | |
</records> | |
<!-- QueryField declarations --> | |
<records interface="plone.app.querystring.interfaces.IQueryField" | |
prefix="plone.app.querystring.field.path"> | |
<value key="title" i18n:translate="">Location</value> | |
<value key="description" i18n:translate="">The location of an item </value> | |
<value key="enabled">True</value> | |
<value key="sortable">False</value> | |
<value key="operations"> | |
<element>plone.app.querystring.operation.string.relativePath</element> | |
<element>plone.app.querystring.operation.string.multiPath</element> | |
<element>plone.app.querystring.operation.string.path</element> | |
</value> | |
<value key="group" i18n:translate="">Metadata</value> | |
</records> | |
</registry> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment