import simplejson

#Declare transform services
parsedate = service(u'http://purl.org/com/zepheira/zen/temporal/parse-date')
obj_urls = service(u'http://purl.org/com/zepheira/zen/moinmodel/get-obj-urls')
link_urls = service(u'http://purl.org/com/zepheira/zen/moinmodel/get-link-urls')

#Used to serve requests for a raw Python dictionary
@handles('GET', 'raw/pydict')
def objectify(resource):
    #Data extraction
    bio = resource.definition_section(u'poet:bio')

    #Output
    obj = {
      u'id': resource.rest_uri,
      u'name': U(bio[u'poet:name'])strip(),
      u'born': U(parsedate(U(bio[u'poet:born']))),
      u'died': U(parsedate(U(bio[u'poet:died']))),
      u'images': obj_urls(bio[u'poet:image']),
      u'wikipedia': link_urls(bio[u'poet:wikipedia']),
      u'description': U(resource.section(u'About')),
    }
    return obj

#Used to serve normal HTTP GET requests for the default representation of this resource
@handles('GET')
def get_artifact(resource):
    return simplejson.dumps(objectify(resource), indent=4)

#Used to serve requests for a collection of resources, in raw form
@handles('collect', 'raw/pydict')
def collect_artifacts(resources):
    return simplejson.dumps([objectify(resource) for resource in resources], indent=4)


@@ -1240,20 +1240,568 @@
 ources%5D, indent=4)%0A%0A
+#Used to process HTTP PUT requests to update this resource%0A@handles('PUT')%0Adef put_artifact(resource_type, body):%0A    data = simplejson.loads(body)%0A    #e.g. %22id%22 : %22http://potlach.org/2008/02/whitart/whitart/7%22%0A    return ARTIFACT_PAGE_TEMPLATE.substitute(data)%0A%0A%0AARTIFACT_PAGE_TEMPLATE = Template(u'''%5C%0A= artifact:metadata =%0A%0A Medium: $medium%0A Creator: $creator%0A Label: $label%0A Date: $date%0A Thimage: %7B%7B$thimage%7D%7D%0A Image: %7B%7B$image%7D%7D%0A%0A= akara:metadata =%0A##Here generic metadata at the Zen/Akara level%0A%0A akara:type:: %5B%5Bpoetpaedia/collection%5D%5D%0A''')%0A%0A

Put complete for arthub demo