content,
<span xmlns:kid="http://purl.org/kid/ns#" kid:omit="">
<?python
from rdflib.util import date_time
from urlparse import urljoin
from urllib import quote
from time import gmtime, time
from kid import XML
TEMPLATE = redfoot.namespace("http://redfoot.net/3.0/template#")
DC = redfoot.namespace("http://purl.org/dc/elements/1.1/")
DCTERMS = redfoot.namespace("http://purl.org/dc/terms/")
SESSION = redfoot.namespace("http://redfoot.net/3.0/session#")
SERVER = redfoot.namespace("http://redfoot.net/3.0/server#")
uri = request.parameters.get("uri")
title = request.parameters.get("title")
head_content_value = request.parameters.get("head_content") or ""
datatype = URIRef(request.parameters.get("format") or "")
head_content_value = Literal(head_content_value, datatype=datatype)
if uri:
uri = URIRef(uri)
# We do the following get context to create the default context if one's not already created.
redfoot.get_context(redfoot.context_id(uri.abstract(), context_id="#context"))
context = redfoot.get_context(redfoot.context_id(uri.abstract(), context_id="#edit_head_content"))
if title:
label = Literal(title)
redfoot.remove((uri, RDFS.label, None))
context.add((uri, RDFS.label, label))
head_content = redfoot.value(uri, TEMPLATE.head_content)
if not head_content or isinstance(head_content, BNode):
head_content = redfoot.context_id(uri.abstract(), context_id="head_content_handler")
for c in redfoot.objects(uri, TEMPLATE.head_content):
context.remove((uri, TEMPLATE.head_content, c))
context.remove((c, None, None))
context.add((uri, TEMPLATE.head_content, head_content))
redfoot.remove((head_content, RDF.value, None))
context.add((head_content, RDF.value, head_content_value))
redfoot.remove((uri, SERVER.last_modified, None))
context.add((uri, SERVER.last_modified, Literal("%s" % time())))
message = ""
if head_content_value.datatype==URIRef("http://redfoot.net/3.0/server#Kid"):
try:
for item in XML(head_content_value, fragment=False):
pass
except Exception, e:
message = str(e)
head_content = None
from urllib import quote
?>
<h2 kid:if="message">${message} <a href="/edit/head_content/?uri=${quote(uri)}">Edit again</a></h2>
<h2 kid:if="not message">Thank you for your head_content:
<a href="${quote(uri.concrete(), ':/')}">${redfoot.label(uri, uri)}</a>
</h2>
</span>
Comments regarding http://redfoot.net/3.0/aspects/edit_head/put_head_content
Login to submit a comment.