Ophelia v0.3.3 documentation


Deutsche Fassung

Modules

ophelia.request

exception ophelia.request.NotFound
Signals that Ophelia can’t find all files needed by the request.
exception ophelia.request.Redirect
Signals that the server should redirect the client to another URI.
class ophelia.request.Request(path, template_root, site, **env)

Ophelia’s request object.

Instantiate as Request(path, template_root, site, **env).

path: str, path to traverse from the site root, elements separated by ‘/’ template_root: str, file system path to the template root site: str, absolute URL to site root, ends with ‘/’ env: the environment

build()
build_content()
build_headers()
get_next()
insert_template(name)
load_macros(name)
process_file(file_path, insert=False)
render_template(name)
tales_namespace(file_context={})
traverse(**context)
traverse_dir()
traverse_file(file_path)
traverse_next()
exception ophelia.request.StopTraversal
Flow control device for scripts to stop directory traversal.
ophelia.request.get_file_context()
ophelia.request.get_request()

ophelia.input

class ophelia.input.Splitter(**options)

Splitter decomposing a file into Python script and template.

Instantiate as Splitter(**options).

ophelia.pagetemplate

class ophelia.pagetemplate.PageTemplate(text, file_path=None, offset=(0, 0))

Page templates with supplemented tracebacks and source tracking.

Call parameters: the namespace of file context variables

pt_getContext(namespaces, names)
pt_source_file()
class ophelia.pagetemplate.PageTemplateTracebackSupplement(template)
getInfo()

ophelia.util

class ophelia.util.Namespace(*args, **kwargs)
Collection of named variables, accessible both as attributes and mapping items.
ophelia.util.strftime(format, t=None)

Similar to time.strftime, but returns unicode.

Decodes the time representation returned by time.strftime according to the character encoding as determined by the current locale.

format: str or unicode, a time format string t: optional, if given: tuple, datetime.datetime, or datetime.time

If t is omitted, the current time is used. If t is a tuple, it must be a valid time tuple as accepted by time.strftime().

returns unicode

ophelia.dump

A script entry point for dumping a page built by Ophelia to stdout.

ophelia.dump.dump(config_file='', section='DEFAULT')

ophelia.wsgi

A WSGI application running Ophelia, and an optional wsgiref server running this application.

class ophelia.wsgi.Application

Ophelia’s WSGI application.

report_exception(env, msg)
ophelia.wsgi.wsgiref_server(config_file='', section='DEFAULT')

ophelia.modpython

ophelia.tool.metadata

class ophelia.tool.metadata.MetaData

Stores, calculates and formats metadata such as dates or digests.

bump_date(*args)

Store the maximum of the given date and that stored before.

*args: datetime.datetime arguments

returns nothing

date(format='%a, %d %b %Y %H:%M:%S GMT')

Format the stored date, defaults to RFC 2822 compliant format.

format: str, format str

returns str

etag()

Calculate an ETag for the page.

returns str

expires(*args)

Calulate a date relative to now, format by RFC 2822.

*args: datetime.timedelta arguments

returns str

mtime()
Return the mtime of the current input file as a datetime object.

ophelia.tool.navigation

class ophelia.tool.navigation.Navigation(home=None)

Stores navigation info, builds hierarchical and breadcrumb menus.

add_menu(entries, root_title=None, root=None)
alt_langs(**kwargs)
current
display_breadcrumbs(sep)
display_menu(depth=3, uri=None)
iter_breadcrumbs()
set_breadcrumb(title)
set_chapter(title)