Skip to content

DOI: Short-URLs via ZMSIndex #133

@drfho

Description

@drfho

When ZMSIndex was a ContentObj-Lib the doi-Python-Script object

from Products.zms import standard
request = container.REQUEST
RESPONSE = request.RESPONSE
zmscontext = context.content
path_ = 'index_html'
if request['traverse_subpath']:
path_ = standard.id_quote('_'.join(request['traverse_subpath']))
catalog = context.zcatalog_index
query = {'zcat_attr_dc_identifier_doi':path_}
rows = catalog(query)
for x in rows:
# ### test ####
# print x['get_uid']
# print context.content.getLinkObj('{$%s}'%x['get_uid'])
# print context.content.getLinkObj('{$%s}'%x['get_uid']).absolute_url()
# return printed
# #############
ob = zmscontext.getLinkObj('{$%s}'%x['get_uid'])
RESPONSE.redirect(ob.absolute_url())
return standard.FileFromData(zmscontext,ob.absolute_url())
# Return a string identifying this script.
return standard.FileFromData(zmscontext,"'%s' not found!"%path_)

could resolve short-URls on basis of an attribute like www.mysite.com/doi/myid

How does it work after the doi()-function has moved with ZMSIndex into ZMS core?

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions