import os
from quixote.directory import Directory, Resolving
from quixote.util import StaticDirectory
from quixote.demo.integers import IntegerUI
class ExtraDirectory(Resolving, Directory):
_q_exports = ["", "form", "src"]
def _q_index [html] (self):
"""
Quixote Demo Extras
Extras
Here are some more features of this demo:
- 12/:
A Python object published through
_q_lookup().
- 12/factorial:
A method on a published Python object.
- form:
A Quixote form in action.
- src/:
A static directory published through Quixote.
"""
def _q_resolve(self, component):
# _q_resolve() is a hook that can be used to import only
# when it's actually accessed. This can be used to make
# start-up of your application faster, because it doesn't have
# to import every single module when it starts running.
if component == 'form':
from quixote.demo.forms import form_demo
return form_demo
def _q_lookup(self, component):
return IntegerUI(component)
def upload(self):
return 'upload demo unfinished'
import quixote
src = StaticDirectory(os.path.dirname(quixote.__file__),
list_directory=True)