Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (42 sloc) 2.63 KB
Controller:
To use the native pylons controller in your pylons app, you need to set up
a controller (which we assume to be called "sword.py" for the duration of this
document, with the content:
from sss.pylons_sword_controller import SwordController
__controller__ = "SwordController"
That is all.
middleware.py
You need to comment out the error handling code in middleware.py otherwise
it will bork the sword error messages, and authentication with http basic will
become impossible
routing.py
In order to make the routes work properly, you need to remove the public/index.html
to make the "/" route work properly
"""Routes configuration
The more specific and detailed routes should be defined first so they
may take precedent over the more generic routes. For more information
refer to the routes manual at http://routes.groovie.org/docs/
"""
from pylons import config
from routes import Mapper
def make_map():
"""Create, configure and return the routes Mapper"""
map = Mapper(directory=config['pylons.paths']['controllers'],
always_scan=config['debug'])
map.minimization = False
# CUSTOM ROUTES HERE
map.connect('/', controller="sword", action="webui") # Home page, with an intro and some handy links
map.connect('/sd-uri', controller="sword", action="service_document") # From which to retrieve the service document
map.connect('/sd-uri/{path:.*?}', controller="sword", action="service_document") # for sub-service documents
map.connect('/col-uri/{path:.*?}', controller="sword", action="collection") # Representing a Collection as listed in the service document
map.connect('/cont-uri/{path:.*?}', controller="sword", action="media_resource") # The URI used in atom:content@src
map.connect('/em-uri/{path:.*?}', controller="sword", action="media_resource") # The URI used in atom:link@rel=edit-media
map.connect('/edit-uri/{path:.*?}', controller="sword", action="container") # The URI used in atom:link@rel=edit
map.connect('/state-uri/{path:.*?}', controller="sword", action="statement") # The URI used in atom:link@rel=sword:statement
map.connect('/agg-uri/{path:.*?}', controller="sword", action="aggregation") # The URI used to represent the ORE aggregation
# NOT PART OF SWORD: sword says nothing about how components of the item are identified, but here we use the
# PART-URI prefix to denote parts of the object in the server
map.connect('/part-uri/{path:.*?}', controller="sword", action="part")
# NOT PART OF SWORD: for convenience to supply HTML pages of deposited content
map.connect('/html/{path:.*?}', controller="sword", action="webui")
return map