going pylons !
git-svn-id: http://yolanda.mister-muffin.de/svn@362 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
494f18a01b
commit
bffdb722ac
78 changed files with 1354 additions and 0 deletions
2
trunk/MANIFEST.in
Normal file
2
trunk/MANIFEST.in
Normal file
|
@ -0,0 +1,2 @@
|
|||
recursive-include yolanda/public *
|
||||
recursive-include yolanda/templates *
|
19
trunk/README.txt
Normal file
19
trunk/README.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
This file is for you to describe the Yolanda application. Typically
|
||||
you would include information such as the information below:
|
||||
|
||||
Installation and Setup
|
||||
======================
|
||||
|
||||
Install ``Yolanda`` using easy_install::
|
||||
|
||||
easy_install Yolanda
|
||||
|
||||
Make a config file as follows::
|
||||
|
||||
paster make-config Yolanda config.ini
|
||||
|
||||
Tweak the config file as appropriate and then setup the application::
|
||||
|
||||
paster setup-app config.ini
|
||||
|
||||
Then you are ready to go.
|
10
trunk/Yolanda.egg-info/PKG-INFO
Normal file
10
trunk/Yolanda.egg-info/PKG-INFO
Normal file
|
@ -0,0 +1,10 @@
|
|||
Metadata-Version: 1.0
|
||||
Name: Yolanda
|
||||
Version: 0.0.0dev
|
||||
Summary: UNKNOWN
|
||||
Home-page: UNKNOWN
|
||||
Author: UNKNOWN
|
||||
Author-email: UNKNOWN
|
||||
License: UNKNOWN
|
||||
Description: UNKNOWN
|
||||
Platform: UNKNOWN
|
29
trunk/Yolanda.egg-info/SOURCES.txt
Normal file
29
trunk/Yolanda.egg-info/SOURCES.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
MANIFEST.in
|
||||
README.txt
|
||||
setup.cfg
|
||||
setup.py
|
||||
Yolanda.egg-info/PKG-INFO
|
||||
Yolanda.egg-info/SOURCES.txt
|
||||
Yolanda.egg-info/dependency_links.txt
|
||||
Yolanda.egg-info/entry_points.txt
|
||||
Yolanda.egg-info/paste_deploy_config.ini_tmpl
|
||||
Yolanda.egg-info/requires.txt
|
||||
Yolanda.egg-info/top_level.txt
|
||||
yolanda/__init__.py
|
||||
yolanda/websetup.py
|
||||
yolanda/config/__init__.py
|
||||
yolanda/config/environment.py
|
||||
yolanda/config/middleware.py
|
||||
yolanda/config/routing.py
|
||||
yolanda/controllers/__init__.py
|
||||
yolanda/controllers/error.py
|
||||
yolanda/controllers/template.py
|
||||
yolanda/lib/__init__.py
|
||||
yolanda/lib/app_globals.py
|
||||
yolanda/lib/base.py
|
||||
yolanda/lib/helpers.py
|
||||
yolanda/model/__init__.py
|
||||
yolanda/public/index.html
|
||||
yolanda/tests/__init__.py
|
||||
yolanda/tests/test_models.py
|
||||
yolanda/tests/functional/__init__.py
|
1
trunk/Yolanda.egg-info/dependency_links.txt
Normal file
1
trunk/Yolanda.egg-info/dependency_links.txt
Normal file
|
@ -0,0 +1 @@
|
|||
|
7
trunk/Yolanda.egg-info/entry_points.txt
Normal file
7
trunk/Yolanda.egg-info/entry_points.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
[paste.app_factory]
|
||||
main = yolanda.config.middleware:make_app
|
||||
|
||||
[paste.app_install]
|
||||
main = pylons.util:PylonsInstaller
|
||||
|
58
trunk/Yolanda.egg-info/paste_deploy_config.ini_tmpl
Normal file
58
trunk/Yolanda.egg-info/paste_deploy_config.ini_tmpl
Normal file
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Yolanda - Pylons configuration
|
||||
#
|
||||
# The %(here)s variable will be replaced with the parent directory of this file
|
||||
#
|
||||
[DEFAULT]
|
||||
debug = true
|
||||
email_to = you@yourdomain.com
|
||||
smtp_server = localhost
|
||||
error_email_from = paste@localhost
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
host = 0.0.0.0
|
||||
port = 5000
|
||||
|
||||
[app:main]
|
||||
use = egg:Yolanda
|
||||
full_stack = true
|
||||
cache_dir = %(here)s/data
|
||||
beaker.session.key = yolanda
|
||||
beaker.session.secret = ${app_instance_secret}
|
||||
app_instance_uuid = ${app_instance_uuid}
|
||||
|
||||
# If you'd like to fine-tune the individual locations of the cache data dirs
|
||||
# for the Cache data, or the Session saves, un-comment the desired settings
|
||||
# here:
|
||||
#beaker.cache.data_dir = %(here)s/data/cache
|
||||
#beaker.session.data_dir = %(here)s/data/sessions
|
||||
|
||||
# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
|
||||
# Debug mode will enable the interactive debugging tool, allowing ANYONE to
|
||||
# execute malicious code after an exception is raised.
|
||||
set debug = false
|
||||
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s
|
3
trunk/Yolanda.egg-info/paster_plugins.txt
Normal file
3
trunk/Yolanda.egg-info/paster_plugins.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Pylons
|
||||
WebHelpers
|
||||
PasteScript
|
1
trunk/Yolanda.egg-info/requires.txt
Normal file
1
trunk/Yolanda.egg-info/requires.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Pylons>=0.9.6.1
|
1
trunk/Yolanda.egg-info/top_level.txt
Normal file
1
trunk/Yolanda.egg-info/top_level.txt
Normal file
|
@ -0,0 +1 @@
|
|||
yolanda
|
|
@ -0,0 +1,12 @@
|
|||
(dp1
|
||||
S'_authentication_token'
|
||||
p2
|
||||
S'141491361115205551276239095199970379580'
|
||||
p3
|
||||
sS'_accessed_time'
|
||||
p4
|
||||
F1217161386.3120041
|
||||
sS'_creation_time'
|
||||
p5
|
||||
F1217161386.3120079
|
||||
s.
|
40
trunk/data/templates/index.mako.py
Normal file
40
trunk/data/templates/index.mako.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1216907993.197489
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/index.mako'
|
||||
_template_uri='/index.mako'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = []
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
h = context.get('h', UNDEFINED)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<h1>\n Welcome to Yolanda\n</h1>\n\n<p>\n This is the front page.\n</p>\n\n<p>\n <a href="">upload video</a>\n</p>\n\n<p>\n\n')
|
||||
# SOURCE LINE 15
|
||||
context.write(unicode( h.form( \
|
||||
h.url(action='/results'), \
|
||||
method='get', \
|
||||
enctype='application/x-www-form-urlencoded' \
|
||||
) ))
|
||||
# SOURCE LINE 19
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 21
|
||||
context.write(unicode( h.text_field('query') ))
|
||||
context.write(u'\n')
|
||||
# SOURCE LINE 22
|
||||
context.write(unicode( h.submit('find video') ))
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 24
|
||||
context.write(unicode( h.end_form() ))
|
||||
context.write(u'\n\n <form action="/results" method="get" enctype="application/x-www-form-urlencoded">\n <fieldset>\n\n <legend>\n search for videos\n </legend>\n\n <input type="text" name="query" />\n <input type="submit" value="find" />\n\n </fieldset>\n </form>\n</p>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/index.mako.pyc
Normal file
BIN
trunk/data/templates/index.mako.pyc
Normal file
Binary file not shown.
22
trunk/data/templates/index.myt.py
Normal file
22
trunk/data/templates/index.myt.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1216815389.6429961
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/index.myt'
|
||||
_template_uri='/index.myt'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = []
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<!-- header -->\n\n<h1>\n Welcome to Yolanda\n</h1>\n\n<p>\n This is the front page.\n</p>\n\n<p>\n <a href="">upload video</a>\n</p>\n\n<p>\n <form action="/results" method="get" enctype="application/x-www-form-urlencoded">\n <fieldset>\n\n <legend>\n search for videos\n </legend>\n\n <input type="text" name="query" />\n <input type="submit" value="find" />\n\n </fieldset>\n </form>\n</p>\n\n<!-- footer -->\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/index.myt.pyc
Normal file
BIN
trunk/data/templates/index.myt.pyc
Normal file
Binary file not shown.
62
trunk/data/templates/results.mako.py
Normal file
62
trunk/data/templates/results.mako.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1216910187.0066929
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/results.mako'
|
||||
_template_uri='/results.mako'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = ['result']
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
h = context.get('h', UNDEFINED)
|
||||
c = context.get('c', UNDEFINED)
|
||||
def result(x):
|
||||
return render_result(context.locals_(__M_locals),x)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<html>\n\n\n<head>\n\n')
|
||||
# SOURCE LINE 6
|
||||
context.write(unicode( h.javascript_include_tag('/javascripts/effects.js', builtins=True) ))
|
||||
context.write(u'\n\n</head>\n\n\n<body>\n\n')
|
||||
# SOURCE LINE 18
|
||||
context.write(u'\n\n<p>\n Here be results for ')
|
||||
# SOURCE LINE 21
|
||||
context.write(unicode(c.query))
|
||||
context.write(u'.\n</p>\n\n')
|
||||
# SOURCE LINE 24
|
||||
for x in range(1,10):
|
||||
# SOURCE LINE 25
|
||||
context.write(u' ')
|
||||
context.write(unicode(result(x)))
|
||||
context.write(u'\n')
|
||||
# SOURCE LINE 27
|
||||
context.write(u'\n</body>\n\n\n</html>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_result(context,x):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
h = context.get('h', UNDEFINED)
|
||||
# SOURCE LINE 13
|
||||
context.write(u'\n <div class="result" id="')
|
||||
# SOURCE LINE 14
|
||||
context.write(unicode(x))
|
||||
context.write(u'">\n ')
|
||||
# SOURCE LINE 15
|
||||
context.write(unicode( h.draggable_element(x, revert=True) ))
|
||||
context.write(u'\n thumbnail and infos for video ')
|
||||
# SOURCE LINE 16
|
||||
context.write(unicode(x))
|
||||
context.write(u'\n </div>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/results.mako.pyc
Normal file
BIN
trunk/data/templates/results.mako.pyc
Normal file
Binary file not shown.
44
trunk/data/templates/results.myt.py
Normal file
44
trunk/data/templates/results.myt.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1216817791.7502799
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/results.myt'
|
||||
_template_uri='/results.myt'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = []
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
h = context.get('h', UNDEFINED)
|
||||
c = context.get('c', UNDEFINED)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<h1>\n Welcome to Yolanda\n</h1>\n\n<p>\n This is the search page.\n</p>\n\n<p>\n')
|
||||
# SOURCE LINE 10
|
||||
h.start_form(h.url_for(action='save', title=c.query), method="get")
|
||||
|
||||
context.write(u'\n ')
|
||||
# SOURCE LINE 11
|
||||
h.text_area(name='content', rows=7, cols=40, content=c.content)
|
||||
|
||||
context.write(u' <br />\n ')
|
||||
# SOURCE LINE 12
|
||||
h.submit(value="Save changes", name='commit')
|
||||
|
||||
context.write(u'\n')
|
||||
# SOURCE LINE 13
|
||||
h.end_form()
|
||||
|
||||
context.write(u'\n\n ')
|
||||
# SOURCE LINE 15
|
||||
c.query
|
||||
|
||||
context.write(u'\n</p>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/results.myt.pyc
Normal file
BIN
trunk/data/templates/results.myt.pyc
Normal file
Binary file not shown.
22
trunk/data/templates/search.myt.py
Normal file
22
trunk/data/templates/search.myt.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1216814715.8671241
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/search.myt'
|
||||
_template_uri='/search.myt'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = []
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<!-- header -->\n\n<h1>\n Welcome to Yolanda\n</h1>\n\n<p>\n This is the search page.\n</p>\n\n<!-- footer -->\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/search.myt.pyc
Normal file
BIN
trunk/data/templates/search.myt.pyc
Normal file
Binary file not shown.
48
trunk/data/templates/xhtml/base.mako.py
Normal file
48
trunk/data/templates/xhtml/base.mako.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1217192624.700382
|
||||
_template_filename=u'/home/nils/src/yolanda/trunk/yolanda/templates/xhtml/base.mako'
|
||||
_template_uri=u'/xhtml/base.mako'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = []
|
||||
|
||||
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
h = context.get('h', UNDEFINED)
|
||||
self = context.get('self', UNDEFINED)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'<?xml version="1.0" ?>\n<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n<html xmlns="http://www.w3.org/1999/xhtml">\n\n<head>\n\n <meta\n http-equiv="Content-Type"\n content="application/xhtml+xml;charset=utf-8"\n />\n\n <link\n rel="stylesheet"\n type="text/css"\n media="screen"\n href="')
|
||||
# SOURCE LINE 18
|
||||
context.write(unicode(h.url_for('/css/default.css')))
|
||||
context.write(u'"\n />\n\n <title>\n Yolanda - ')
|
||||
# SOURCE LINE 22
|
||||
context.write(unicode(self.title()))
|
||||
context.write(u'\n </title>\n\n</head>\n\n<body>\n\n <div id="heading-box">\n <h1>\n ')
|
||||
# SOURCE LINE 31
|
||||
context.write(unicode(self.heading()))
|
||||
context.write(u'\n </h1>\n </div>\n\n <div id="search-box">\n\n <h1>\n Search all videos\n </h1>\n\n ')
|
||||
# SOURCE LINE 41
|
||||
context.write(unicode(h.form(h.url_for('search_results'), method='get')))
|
||||
context.write(u'\n\n ')
|
||||
# SOURCE LINE 43
|
||||
context.write(unicode(h.text_field('query')))
|
||||
context.write(u'\n ')
|
||||
# SOURCE LINE 44
|
||||
context.write(unicode(h.submit('Search')))
|
||||
context.write(u'\n\n ')
|
||||
# SOURCE LINE 46
|
||||
context.write(unicode(h.end_form()))
|
||||
context.write(u'\n\n </div>\n\n ')
|
||||
# SOURCE LINE 50
|
||||
context.write(unicode(self.body()))
|
||||
context.write(u'\n\n <div id="copyright">\n <em>Yolanda</em> Copyright © 2007, 2008 <em>The Yolanda Developers</em> –\n This program comes with <em>absolutely no warranty</em>; for details <a href="">click here</a>.\n This is <em>free software</em>, and you are welcome to redistribute it\n under certain conditions; <a href="">click here</a> for details.\n To view the source code, <a href="">click here</a>. Report bugs <a href="">here</a>.\n </div>\n\n <ul id="antipixel" role="navigation">\n\n <li>\n <a href="http://validator.w3.org/">\n <img alt="XHTML 1.1 logo" class="antipixel" src="" />\n </a>\n </li>\n\n <li>\n <a href="http://jigsaw.w3.org/css-validator/">\n <img alt="CSS logo" class="antipixel" src="" />\n </a>\n </li>\n\n <li>\n <a href="">\n <img alt="Javascript logo" class="antipixel" src="" />\n </a>\n </li>\n\n <li>\n <a href="http://www.theora.org/">\n <img alt="Ogg Theora logo" class="antipixel" src="" />\n </a>\n </li>\n\n </ul>\n\n</body>\n\n</html>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/xhtml/base.mako.pyc
Normal file
BIN
trunk/data/templates/xhtml/base.mako.pyc
Normal file
Binary file not shown.
57
trunk/data/templates/xhtml/index.mako.py
Normal file
57
trunk/data/templates/xhtml/index.mako.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1217192819.900584
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/xhtml/index.mako'
|
||||
_template_uri='/xhtml/index.mako'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = ['heading', 'title']
|
||||
|
||||
|
||||
def _mako_get_namespace(context, name):
|
||||
try:
|
||||
return context.namespaces[(__name__, name)]
|
||||
except KeyError:
|
||||
_mako_generate_namespaces(context)
|
||||
return context.namespaces[(__name__, name)]
|
||||
def _mako_generate_namespaces(context):
|
||||
pass
|
||||
def _mako_inherit(template, context):
|
||||
_mako_generate_namespaces(context)
|
||||
return runtime._inherit_from(context, u'base.mako', _template_uri)
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 5
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 9
|
||||
context.write(u'\n\nLOL INDEX\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_heading(context):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
# SOURCE LINE 7
|
||||
context.write(u'\n Welcome, youngling !\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_title(context):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
# SOURCE LINE 3
|
||||
context.write(u'\n front page\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/xhtml/index.mako.pyc
Normal file
BIN
trunk/data/templates/xhtml/index.mako.pyc
Normal file
Binary file not shown.
105
trunk/data/templates/xhtml/results.mako.py
Normal file
105
trunk/data/templates/xhtml/results.mako.py
Normal file
|
@ -0,0 +1,105 @@
|
|||
from mako import runtime, filters, cache
|
||||
UNDEFINED = runtime.UNDEFINED
|
||||
_magic_number = 2
|
||||
_modified_time = 1217192310.2031181
|
||||
_template_filename='/home/nils/src/yolanda/trunk/yolanda/templates/xhtml/results.mako'
|
||||
_template_uri='/xhtml/results.mako'
|
||||
_template_cache=cache.Cache(__name__, _modified_time)
|
||||
_source_encoding=None
|
||||
_exports = ['results_listing', 'heading', 'title']
|
||||
|
||||
|
||||
def _mako_get_namespace(context, name):
|
||||
try:
|
||||
return context.namespaces[(__name__, name)]
|
||||
except KeyError:
|
||||
_mako_generate_namespaces(context)
|
||||
return context.namespaces[(__name__, name)]
|
||||
def _mako_generate_namespaces(context):
|
||||
pass
|
||||
def _mako_inherit(template, context):
|
||||
_mako_generate_namespaces(context)
|
||||
return runtime._inherit_from(context, u'base.mako', _template_uri)
|
||||
def render_body(context,**pageargs):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
__M_locals = dict(pageargs=pageargs)
|
||||
def results_listing(results):
|
||||
return render_results_listing(context.locals_(__M_locals),results)
|
||||
c = context.get('c', UNDEFINED)
|
||||
# SOURCE LINE 1
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 5
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 9
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 25
|
||||
context.write(u'\n\n')
|
||||
# SOURCE LINE 27
|
||||
context.write(unicode(results_listing(c.results)))
|
||||
context.write(u'\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_results_listing(context,results):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
h = context.get('h', UNDEFINED)
|
||||
c = context.get('c', UNDEFINED)
|
||||
# SOURCE LINE 11
|
||||
context.write(u'\n <ol id="results">\n')
|
||||
# SOURCE LINE 13
|
||||
for result in c.results:
|
||||
# SOURCE LINE 14
|
||||
context.write(u' <li id="result">\n <a href="')
|
||||
# SOURCE LINE 15
|
||||
context.write(unicode(h.url_for('video_page', video=result)))
|
||||
context.write(u'">\n <img src="')
|
||||
# SOURCE LINE 16
|
||||
context.write(unicode(result['thumbnail']))
|
||||
context.write(u'" alt=\'thumbnail for "')
|
||||
context.write(unicode(result['title']))
|
||||
context.write(u'"\'/>\n </a>\n <br />\n <a href="')
|
||||
# SOURCE LINE 19
|
||||
context.write(unicode(h.url_for('video_page', video=result)))
|
||||
context.write(u'">\n ')
|
||||
# SOURCE LINE 20
|
||||
context.write(unicode(result['title']))
|
||||
context.write(u'\n </a>\n </li>\n')
|
||||
# SOURCE LINE 24
|
||||
context.write(u' </ol>\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_heading(context):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
c = context.get('c', UNDEFINED)
|
||||
# SOURCE LINE 7
|
||||
context.write(u'\n 9001 results for "')
|
||||
# SOURCE LINE 8
|
||||
context.write(unicode(c.query))
|
||||
context.write(u'":\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
||||
def render_title(context):
|
||||
context.caller_stack.push_frame()
|
||||
try:
|
||||
c = context.get('c', UNDEFINED)
|
||||
# SOURCE LINE 3
|
||||
context.write(u'\n results for "')
|
||||
# SOURCE LINE 4
|
||||
context.write(unicode(c.query))
|
||||
context.write(u'"\n')
|
||||
return ''
|
||||
finally:
|
||||
context.caller_stack.pop_frame()
|
||||
|
||||
|
BIN
trunk/data/templates/xhtml/results.mako.pyc
Normal file
BIN
trunk/data/templates/xhtml/results.mako.pyc
Normal file
Binary file not shown.
64
trunk/development.ini
Normal file
64
trunk/development.ini
Normal file
|
@ -0,0 +1,64 @@
|
|||
#
|
||||
# Yolanda - Pylons development environment configuration
|
||||
#
|
||||
# The %(here)s variable will be replaced with the parent directory of this file
|
||||
#
|
||||
[DEFAULT]
|
||||
debug = true
|
||||
# Uncomment and replace with the address which should receive any error reports
|
||||
#email_to = you@yourdomain.com
|
||||
smtp_server = localhost
|
||||
error_email_from = paste@localhost
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
host = 0.0.0.0
|
||||
port = 5000
|
||||
|
||||
[app:main]
|
||||
use = egg:Yolanda
|
||||
full_stack = true
|
||||
cache_dir = %(here)s/data
|
||||
beaker.session.key = yolanda
|
||||
beaker.session.secret = somesecret
|
||||
|
||||
# If you'd like to fine-tune the individual locations of the cache data dirs
|
||||
# for the Cache data, or the Session saves, un-comment the desired settings
|
||||
# here:
|
||||
#beaker.cache.data_dir = %(here)s/data/cache
|
||||
#beaker.session.data_dir = %(here)s/data/sessions
|
||||
|
||||
# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
|
||||
# Debug mode will enable the interactive debugging tool, allowing ANYONE to
|
||||
# execute malicious code after an exception is raised.
|
||||
#set debug = false
|
||||
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
keys = root, yolanda
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[logger_yolanda]
|
||||
level = DEBUG
|
||||
handlers =
|
||||
qualname = yolanda
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
12
trunk/docs/index.txt
Normal file
12
trunk/docs/index.txt
Normal file
|
@ -0,0 +1,12 @@
|
|||
yolanda
|
||||
+++++++
|
||||
|
||||
This is the main index page of your documentation. It should be written in
|
||||
`reStructuredText format <http://docutils.sourceforge.net/rst.html>`_.
|
||||
|
||||
You can generate your documentation in HTML format by running this command::
|
||||
|
||||
setup.py pudge
|
||||
|
||||
For this to work you will need to download and install ``buildutils`` and
|
||||
``pudge``.
|
59
trunk/setup.cfg
Normal file
59
trunk/setup.cfg
Normal file
|
@ -0,0 +1,59 @@
|
|||
[egg_info]
|
||||
tag_build = dev
|
||||
tag_svn_revision = true
|
||||
|
||||
[easy_install]
|
||||
find_links = http://www.pylonshq.com/download/
|
||||
|
||||
[pudge]
|
||||
theme = pythonpaste.org
|
||||
|
||||
# Add extra doc files here with spaces between them
|
||||
docs = docs/index.txt
|
||||
|
||||
# Doc Settings
|
||||
doc_base = docs/
|
||||
dest = docs/html
|
||||
|
||||
# Add extra modules here separated with commas
|
||||
modules = yolanda
|
||||
title = Yolanda
|
||||
organization = Pylons
|
||||
|
||||
# Highlight code-block sections with Pygments
|
||||
highlighter = pygments
|
||||
|
||||
# Optionally add extra links
|
||||
#organization_url = http://pylonshq.com/
|
||||
#trac_url = http://pylonshq.com/project
|
||||
settings = no_about=true
|
||||
|
||||
# Optionally add extra settings
|
||||
# link1=/community/ Community
|
||||
# link2=/download/ Download
|
||||
|
||||
[publish]
|
||||
doc-dir=docs/html
|
||||
make-dirs=1
|
||||
|
||||
# Babel configuration
|
||||
[compile_catalog]
|
||||
domain = yolanda
|
||||
directory = yolanda/i18n
|
||||
statistics = true
|
||||
|
||||
[extract_messages]
|
||||
add_comments = TRANSLATORS:
|
||||
output_file = yolanda/i18n/yolanda.pot
|
||||
width = 80
|
||||
|
||||
[init_catalog]
|
||||
domain = yolanda
|
||||
input_file = yolanda/i18n/yolanda.pot
|
||||
output_dir = yolanda/i18n
|
||||
|
||||
[update_catalog]
|
||||
domain = yolanda
|
||||
input_file = yolanda/i18n/yolanda.pot
|
||||
output_dir = yolanda/i18n
|
||||
previous = true
|
31
trunk/setup.py
Normal file
31
trunk/setup.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
try:
|
||||
from setuptools import setup, find_packages
|
||||
except ImportError:
|
||||
from ez_setup import use_setuptools
|
||||
use_setuptools()
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name='Yolanda',
|
||||
version="",
|
||||
#description='',
|
||||
#author='',
|
||||
#author_email='',
|
||||
#url='',
|
||||
install_requires=["Pylons>=0.9.6.1"],
|
||||
packages=find_packages(exclude=['ez_setup']),
|
||||
include_package_data=True,
|
||||
test_suite='nose.collector',
|
||||
package_data={'yolanda': ['i18n/*/LC_MESSAGES/*.mo']},
|
||||
#message_extractors = {'yolanda': [
|
||||
# ('**.py', 'python', None),
|
||||
# ('templates/**.mako', 'mako', None),
|
||||
# ('public/**', 'ignore', None)]},
|
||||
entry_points="""
|
||||
[paste.app_factory]
|
||||
main = yolanda.config.middleware:make_app
|
||||
|
||||
[paste.app_install]
|
||||
main = pylons.util:PylonsInstaller
|
||||
""",
|
||||
)
|
21
trunk/test.ini
Normal file
21
trunk/test.ini
Normal file
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Yolanda - Pylons testing environment configuration
|
||||
#
|
||||
# The %(here)s variable will be replaced with the parent directory of this file
|
||||
#
|
||||
[DEFAULT]
|
||||
debug = true
|
||||
# Uncomment and replace with the address which should receive any error reports
|
||||
#email_to = you@yourdomain.com
|
||||
smtp_server = localhost
|
||||
error_email_from = paste@localhost
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
host = 0.0.0.0
|
||||
port = 5000
|
||||
|
||||
[app:main]
|
||||
use = config:development.ini
|
||||
|
||||
# Add additional test specific configuration options as necessary.
|
0
trunk/yolanda/__init__.py
Normal file
0
trunk/yolanda/__init__.py
Normal file
BIN
trunk/yolanda/__init__.pyc
Normal file
BIN
trunk/yolanda/__init__.pyc
Normal file
Binary file not shown.
0
trunk/yolanda/config/__init__.py
Normal file
0
trunk/yolanda/config/__init__.py
Normal file
BIN
trunk/yolanda/config/__init__.pyc
Normal file
BIN
trunk/yolanda/config/__init__.pyc
Normal file
Binary file not shown.
33
trunk/yolanda/config/environment.py
Normal file
33
trunk/yolanda/config/environment.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
"""Pylons environment configuration"""
|
||||
import os
|
||||
|
||||
from pylons import config
|
||||
|
||||
import yolanda.lib.app_globals as app_globals
|
||||
import yolanda.lib.helpers
|
||||
from yolanda.config.routing import make_map
|
||||
|
||||
def load_environment(global_conf, app_conf):
|
||||
"""Configure the Pylons environment via the ``pylons.config``
|
||||
object
|
||||
"""
|
||||
# Pylons paths
|
||||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
paths = dict(root=root,
|
||||
controllers=os.path.join(root, 'controllers'),
|
||||
static_files=os.path.join(root, 'public'),
|
||||
templates=[os.path.join(root, 'templates')])
|
||||
|
||||
# Initialize config with the basic options
|
||||
config.init_app(global_conf, app_conf, package='yolanda',
|
||||
template_engine='mako', paths=paths)
|
||||
|
||||
config['routes.map'] = make_map()
|
||||
config['pylons.g'] = app_globals.Globals()
|
||||
config['pylons.h'] = yolanda.lib.helpers
|
||||
|
||||
# Customize templating options via this variable
|
||||
tmpl_options = config['buffet.template_options']
|
||||
|
||||
# CONFIGURATION OPTIONS HERE (note: all config options will override
|
||||
# any Pylons config options)
|
BIN
trunk/yolanda/config/environment.pyc
Normal file
BIN
trunk/yolanda/config/environment.pyc
Normal file
Binary file not shown.
57
trunk/yolanda/config/middleware.py
Normal file
57
trunk/yolanda/config/middleware.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
"""Pylons middleware initialization"""
|
||||
from paste.cascade import Cascade
|
||||
from paste.registry import RegistryManager
|
||||
from paste.urlparser import StaticURLParser
|
||||
from paste.deploy.converters import asbool
|
||||
|
||||
from pylons import config
|
||||
from pylons.error import error_template
|
||||
from pylons.middleware import error_mapper, ErrorDocuments, ErrorHandler, \
|
||||
StaticJavascripts
|
||||
from pylons.wsgiapp import PylonsApp
|
||||
|
||||
from yolanda.config.environment import load_environment
|
||||
|
||||
def make_app(global_conf, full_stack=True, **app_conf):
|
||||
"""Create a Pylons WSGI application and return it
|
||||
|
||||
``global_conf``
|
||||
The inherited configuration for this application. Normally from
|
||||
the [DEFAULT] section of the Paste ini file.
|
||||
|
||||
``full_stack``
|
||||
Whether or not this application provides a full WSGI stack (by
|
||||
default, meaning it handles its own exceptions and errors).
|
||||
Disable full_stack when this application is "managed" by
|
||||
another WSGI middleware.
|
||||
|
||||
``app_conf``
|
||||
The application's local configuration. Normally specified in the
|
||||
[app:<name>] section of the Paste ini file (where <name>
|
||||
defaults to main).
|
||||
"""
|
||||
# Configure the Pylons environment
|
||||
load_environment(global_conf, app_conf)
|
||||
|
||||
# The Pylons WSGI app
|
||||
app = PylonsApp()
|
||||
|
||||
# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
|
||||
|
||||
if asbool(full_stack):
|
||||
# Handle Python exceptions
|
||||
app = ErrorHandler(app, global_conf, error_template=error_template,
|
||||
**config['pylons.errorware'])
|
||||
|
||||
# Display error documents for 401, 403, 404 status codes (and
|
||||
# 500 when debug is disabled)
|
||||
app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
|
||||
|
||||
# Establish the Registry for this application
|
||||
app = RegistryManager(app)
|
||||
|
||||
# Static files
|
||||
javascripts_app = StaticJavascripts()
|
||||
static_app = StaticURLParser(config['pylons.paths']['static_files'])
|
||||
app = Cascade([static_app, javascripts_app, app])
|
||||
return app
|
BIN
trunk/yolanda/config/middleware.pyc
Normal file
BIN
trunk/yolanda/config/middleware.pyc
Normal file
Binary file not shown.
46
trunk/yolanda/config/routing.py
Normal file
46
trunk/yolanda/config/routing.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
"""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'])
|
||||
|
||||
# The ErrorController route (handles 404/500 error pages); it should
|
||||
# likely stay at the top, ensuring it can always be resolved
|
||||
map.connect('error/:action/:id', controller='error')
|
||||
|
||||
# CUSTOM ROUTES HERE
|
||||
|
||||
# front page (search form and search errors)
|
||||
map.connect('', controller='index', action='index')
|
||||
|
||||
# search results
|
||||
map.connect('search_results', 'results', controller='search', action='results')
|
||||
|
||||
# videos
|
||||
def video_expand(kargs):
|
||||
# only alter kargs if a video keyword arg is present
|
||||
if 'video' not in kargs:
|
||||
return kargs
|
||||
|
||||
video = kargs.pop('video')
|
||||
kargs['id'] = video['id']
|
||||
kargs['title'] = video['title']
|
||||
|
||||
return kargs
|
||||
|
||||
map.connect('video_page', 'video/:id/:title', controller='video', _filter=video_expand)
|
||||
# map.connect('video_file', 'video/:id.ogv', controller='video', action='file' _filter=video_expand)
|
||||
|
||||
# everything else
|
||||
map.connect(':controller/:action/:id')
|
||||
# map.connect('*url', controller='template', action='view')
|
||||
|
||||
return map
|
BIN
trunk/yolanda/config/routing.pyc
Normal file
BIN
trunk/yolanda/config/routing.pyc
Normal file
Binary file not shown.
0
trunk/yolanda/controllers/__init__.py
Normal file
0
trunk/yolanda/controllers/__init__.py
Normal file
BIN
trunk/yolanda/controllers/__init__.pyc
Normal file
BIN
trunk/yolanda/controllers/__init__.pyc
Normal file
Binary file not shown.
13
trunk/yolanda/controllers/account.py
Normal file
13
trunk/yolanda/controllers/account.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import logging
|
||||
|
||||
from yolanda.lib.base import *
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class AccountController(BaseController):
|
||||
|
||||
def index(self):
|
||||
# Return a rendered template
|
||||
# return render('/some/template.mako')
|
||||
# or, Return a response
|
||||
return 'account'
|
39
trunk/yolanda/controllers/error.py
Normal file
39
trunk/yolanda/controllers/error.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
import os.path
|
||||
|
||||
import paste.fileapp
|
||||
from pylons.middleware import error_document_template, media_path
|
||||
|
||||
from yolanda.lib.base import *
|
||||
|
||||
class ErrorController(BaseController):
|
||||
"""Generates error documents as and when they are required.
|
||||
|
||||
The ErrorDocuments middleware forwards to ErrorController when error
|
||||
related status codes are returned from the application.
|
||||
|
||||
This behaviour can be altered by changing the parameters to the
|
||||
ErrorDocuments middleware in your config/middleware.py file.
|
||||
"""
|
||||
|
||||
def document(self):
|
||||
"""Render the error document"""
|
||||
page = error_document_template % \
|
||||
dict(prefix=request.environ.get('SCRIPT_NAME', ''),
|
||||
code=request.params.get('code', ''),
|
||||
message=request.params.get('message', ''))
|
||||
return page
|
||||
|
||||
def img(self, id):
|
||||
"""Serve Pylons' stock images"""
|
||||
return self._serve_file(os.path.join(media_path, 'img', id))
|
||||
|
||||
def style(self, id):
|
||||
"""Serve Pylons' stock stylesheets"""
|
||||
return self._serve_file(os.path.join(media_path, 'style', id))
|
||||
|
||||
def _serve_file(self, path):
|
||||
"""Call Paste's FileApp (a WSGI application) to serve the file
|
||||
at the specified path
|
||||
"""
|
||||
fapp = paste.fileapp.FileApp(path)
|
||||
return fapp(request.environ, self.start_response)
|
BIN
trunk/yolanda/controllers/error.pyc
Normal file
BIN
trunk/yolanda/controllers/error.pyc
Normal file
Binary file not shown.
10
trunk/yolanda/controllers/index.py
Normal file
10
trunk/yolanda/controllers/index.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
import logging
|
||||
|
||||
from yolanda.lib.base import *
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class IndexController(BaseController):
|
||||
|
||||
def index(self):
|
||||
return render('/xhtml/index.mako')
|
BIN
trunk/yolanda/controllers/index.pyc
Normal file
BIN
trunk/yolanda/controllers/index.pyc
Normal file
Binary file not shown.
31
trunk/yolanda/controllers/search.py
Normal file
31
trunk/yolanda/controllers/search.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import logging
|
||||
|
||||
from yolanda.lib.base import *
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class SearchController(BaseController):
|
||||
|
||||
def results(self):
|
||||
|
||||
# maybe c.query could / should be a dictionary ?
|
||||
c.query = request.params['query']
|
||||
|
||||
# c.results dummy
|
||||
c.results = [
|
||||
{'title': 'foobar', 'id': '23' , 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'blablupp', 'id': '42', 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'uiae nrdt', 'id': '555' , 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'uiaenrtd uiaenrtd uiaenrdt', 'id': '666666666', 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'foobar', 'id': '23' , 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'blablupp', 'id': '42', 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'James Bond drives a bulletproof Aston Martin !!!', 'id': '555' , 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'uiaenrtd uiaenrtd uiaenrdt uiaenrtd uiaenrtd', 'id': '666666666', 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'foobar', 'id': '123' , 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'blablupp', 'id': '42', 'thumbnail': h.url_for('/images/404.png')},
|
||||
{'title': 'lolwtf hax !!!11', 'id': '9001', 'thumbnail': h.url_for('/images/404.png')}
|
||||
]
|
||||
|
||||
return render('/xhtml/results.mako')
|
||||
# return request.params['query']
|
||||
# return h.form(h.url(action='search'), method='get')
|
BIN
trunk/yolanda/controllers/search.pyc
Normal file
BIN
trunk/yolanda/controllers/search.pyc
Normal file
Binary file not shown.
27
trunk/yolanda/controllers/template.py
Normal file
27
trunk/yolanda/controllers/template.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from yolanda.lib.base import *
|
||||
|
||||
class TemplateController(BaseController):
|
||||
|
||||
def view(self, url):
|
||||
"""By default, the final controller tried to fulfill the request
|
||||
when no other routes match. It may be used to display a template
|
||||
when all else fails, e.g.::
|
||||
|
||||
def view(self, url):
|
||||
return render('/%s' % url)
|
||||
|
||||
Or if you're using Mako and want to explicitly send a 404 (Not
|
||||
Found) response code when the requested template doesn't exist::
|
||||
|
||||
import mako.exceptions
|
||||
|
||||
def view(self, url):
|
||||
try:
|
||||
return render('/%s' % url)
|
||||
except mako.exceptions.TopLevelLookupException:
|
||||
abort(404)
|
||||
|
||||
By default this controller aborts the request with a 404 (Not
|
||||
Found)
|
||||
"""
|
||||
abort(404)
|
BIN
trunk/yolanda/controllers/template.pyc
Normal file
BIN
trunk/yolanda/controllers/template.pyc
Normal file
Binary file not shown.
14
trunk/yolanda/controllers/video.py
Normal file
14
trunk/yolanda/controllers/video.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import logging
|
||||
|
||||
from yolanda.lib.base import *
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
class VideoController(BaseController):
|
||||
|
||||
def index(self):
|
||||
return 'show a video html page'
|
||||
|
||||
def file(self):
|
||||
return 'serve video'
|
||||
|
BIN
trunk/yolanda/controllers/video.pyc
Normal file
BIN
trunk/yolanda/controllers/video.pyc
Normal file
Binary file not shown.
0
trunk/yolanda/lib/__init__.py
Normal file
0
trunk/yolanda/lib/__init__.py
Normal file
BIN
trunk/yolanda/lib/__init__.pyc
Normal file
BIN
trunk/yolanda/lib/__init__.pyc
Normal file
Binary file not shown.
14
trunk/yolanda/lib/app_globals.py
Normal file
14
trunk/yolanda/lib/app_globals.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
"""The application's Globals object"""
|
||||
from pylons import config
|
||||
|
||||
class Globals(object):
|
||||
"""Globals acts as a container for objects available throughout the
|
||||
life of the application
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
"""One instance of Globals is created during application
|
||||
initialization and is available during requests via the 'g'
|
||||
variable
|
||||
"""
|
||||
pass
|
BIN
trunk/yolanda/lib/app_globals.pyc
Normal file
BIN
trunk/yolanda/lib/app_globals.pyc
Normal file
Binary file not shown.
27
trunk/yolanda/lib/base.py
Normal file
27
trunk/yolanda/lib/base.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
"""The base Controller API
|
||||
|
||||
Provides the BaseController class for subclassing, and other objects
|
||||
utilized by Controllers.
|
||||
"""
|
||||
from pylons import c, cache, config, g, request, response, session
|
||||
from pylons.controllers import WSGIController
|
||||
from pylons.controllers.util import abort, etag_cache, redirect_to
|
||||
from pylons.decorators import jsonify, validate
|
||||
from pylons.i18n import _, ungettext, N_
|
||||
from pylons.templating import render
|
||||
|
||||
import yolanda.lib.helpers as h
|
||||
import yolanda.model as model
|
||||
|
||||
class BaseController(WSGIController):
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
"""Invoke the Controller"""
|
||||
# WSGIController.__call__ dispatches to the Controller method
|
||||
# the request is routed to. This routing information is
|
||||
# available in environ['pylons.routes_dict']
|
||||
return WSGIController.__call__(self, environ, start_response)
|
||||
|
||||
# Include the '_' function in the public names
|
||||
__all__ = [__name for __name in locals().keys() if not __name.startswith('_') \
|
||||
or __name == '_']
|
BIN
trunk/yolanda/lib/base.pyc
Normal file
BIN
trunk/yolanda/lib/base.pyc
Normal file
Binary file not shown.
6
trunk/yolanda/lib/helpers.py
Normal file
6
trunk/yolanda/lib/helpers.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
"""Helper functions
|
||||
|
||||
Consists of functions to typically be used within templates, but also
|
||||
available to Controllers. This module is available to both as 'h'.
|
||||
"""
|
||||
from webhelpers import *
|
BIN
trunk/yolanda/lib/helpers.pyc
Normal file
BIN
trunk/yolanda/lib/helpers.pyc
Normal file
Binary file not shown.
0
trunk/yolanda/model/__init__.py
Normal file
0
trunk/yolanda/model/__init__.py
Normal file
BIN
trunk/yolanda/model/__init__.pyc
Normal file
BIN
trunk/yolanda/model/__init__.pyc
Normal file
Binary file not shown.
97
trunk/yolanda/public/css/default.css
Normal file
97
trunk/yolanda/public/css/default.css
Normal file
|
@ -0,0 +1,97 @@
|
|||
/* reset */
|
||||
*
|
||||
{
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/* re/b/oot */
|
||||
body
|
||||
{
|
||||
padding-bottom: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div
|
||||
{
|
||||
background-color: #eeeeec;
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
form
|
||||
{
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
form input
|
||||
{
|
||||
font-size: 1.2em;
|
||||
width: 11em;
|
||||
}
|
||||
|
||||
form input[type="text"]
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
font-size: 1.2em;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
ol, ul[role="navigation"]
|
||||
{
|
||||
list-style-position: inside;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
ol#results
|
||||
{
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
ol#results li
|
||||
{
|
||||
display: inline-block;
|
||||
padding: 0.5em;
|
||||
vertical-align: top;
|
||||
width: 227px;
|
||||
}
|
||||
|
||||
ol#results li img
|
||||
{
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
#antipixel li, #footer li
|
||||
{
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#antipixel li
|
||||
{
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
#copyright
|
||||
{
|
||||
background-color: #eeeeec;
|
||||
clear: right;
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
margin: 0.5em;
|
||||
padding: 0.5em;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
#heading-box, #search-box
|
||||
{
|
||||
clear: right;
|
||||
float: right;
|
||||
width: 15em;
|
||||
}
|
BIN
trunk/yolanda/public/images/404.png
Normal file
BIN
trunk/yolanda/public/images/404.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
90
trunk/yolanda/templates/xhtml/base.mako
Normal file
90
trunk/yolanda/templates/xhtml/base.mako
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
|
||||
<meta
|
||||
http-equiv="Content-Type"
|
||||
content="application/xhtml+xml;charset=utf-8"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
media="screen"
|
||||
href="${h.url_for('/css/default.css')}"
|
||||
/>
|
||||
|
||||
<title>
|
||||
Yolanda - ${self.title()}
|
||||
</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="heading-box">
|
||||
<h1>
|
||||
${self.heading()}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="search-box">
|
||||
|
||||
<h1>
|
||||
Search all videos
|
||||
</h1>
|
||||
|
||||
${h.form(h.url_for('search_results'), method='get')}
|
||||
|
||||
${h.text_field('query')}
|
||||
${h.submit('Search')}
|
||||
|
||||
${h.end_form()}
|
||||
|
||||
</div>
|
||||
|
||||
${self.body()}
|
||||
|
||||
<div id="copyright">
|
||||
<em>Yolanda</em> Copyright © 2007, 2008 <em>The Yolanda Developers</em> –
|
||||
This program comes with <em>absolutely no warranty</em>; for details <a href="">click here</a>.
|
||||
This is <em>free software</em>, and you are welcome to redistribute it
|
||||
under certain conditions; <a href="">click here</a> for details.
|
||||
To view the source code, <a href="">click here</a>. Report bugs <a href="">here</a>.
|
||||
</div>
|
||||
|
||||
<ul id="antipixel" role="navigation">
|
||||
|
||||
<li>
|
||||
<a href="http://validator.w3.org/">
|
||||
<img alt="XHTML 1.1 logo" class="antipixel" src="" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="http://jigsaw.w3.org/css-validator/">
|
||||
<img alt="CSS logo" class="antipixel" src="" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="">
|
||||
<img alt="Javascript logo" class="antipixel" src="" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="http://www.theora.org/">
|
||||
<img alt="Ogg Theora logo" class="antipixel" src="" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
11
trunk/yolanda/templates/xhtml/index.mako
Normal file
11
trunk/yolanda/templates/xhtml/index.mako
Normal file
|
@ -0,0 +1,11 @@
|
|||
<%inherit file="base.mako"/>
|
||||
|
||||
<%def name="title()">
|
||||
front page
|
||||
</%def>
|
||||
|
||||
<%def name="heading()">
|
||||
Welcome, youngling !
|
||||
</%def>
|
||||
|
||||
LOL INDEX
|
27
trunk/yolanda/templates/xhtml/results.mako
Normal file
27
trunk/yolanda/templates/xhtml/results.mako
Normal file
|
@ -0,0 +1,27 @@
|
|||
<%inherit file="base.mako"/>
|
||||
|
||||
<%def name="title()">
|
||||
results for "${c.query}"
|
||||
</%def>
|
||||
|
||||
<%def name="heading()">
|
||||
9001 results for "${c.query}":
|
||||
</%def>
|
||||
|
||||
<%def name="results_listing(results)">
|
||||
<ol id="results">
|
||||
% for result in c.results:
|
||||
<li id="result">
|
||||
<a href="${h.url_for('video_page', video=result)}">
|
||||
<img src="${result['thumbnail']}" alt='thumbnail for "${result['title']}"'/>
|
||||
</a>
|
||||
<br />
|
||||
<a href="${h.url_for('video_page', video=result)}">
|
||||
${result['title']}
|
||||
</a>
|
||||
</li>
|
||||
% endfor
|
||||
</ol>
|
||||
</%def>
|
||||
|
||||
${results_listing(c.results)}
|
40
trunk/yolanda/tests/__init__.py
Normal file
40
trunk/yolanda/tests/__init__.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
"""Pylons application test package
|
||||
|
||||
When the test runner finds and executes tests within this directory,
|
||||
this file will be loaded to setup the test environment.
|
||||
|
||||
It registers the root directory of the project in sys.path and
|
||||
pkg_resources, in case the project hasn't been installed with
|
||||
setuptools. It also initializes the application via websetup (paster
|
||||
setup-app) with the project's test.ini configuration file.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from unittest import TestCase
|
||||
|
||||
import pkg_resources
|
||||
import paste.fixture
|
||||
import paste.script.appinstall
|
||||
from paste.deploy import loadapp
|
||||
from routes import url_for
|
||||
|
||||
__all__ = ['url_for', 'TestController']
|
||||
|
||||
here_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
conf_dir = os.path.dirname(os.path.dirname(here_dir))
|
||||
|
||||
sys.path.insert(0, conf_dir)
|
||||
pkg_resources.working_set.add_entry(conf_dir)
|
||||
pkg_resources.require('Paste')
|
||||
pkg_resources.require('PasteScript')
|
||||
|
||||
test_file = os.path.join(conf_dir, 'test.ini')
|
||||
cmd = paste.script.appinstall.SetupCommand('setup-app')
|
||||
cmd.run([test_file])
|
||||
|
||||
class TestController(TestCase):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
wsgiapp = loadapp('config:test.ini', relative_to=conf_dir)
|
||||
self.app = paste.fixture.TestApp(wsgiapp)
|
||||
TestCase.__init__(self, *args, **kwargs)
|
0
trunk/yolanda/tests/functional/__init__.py
Normal file
0
trunk/yolanda/tests/functional/__init__.py
Normal file
7
trunk/yolanda/tests/functional/test_account.py
Normal file
7
trunk/yolanda/tests/functional/test_account.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from yolanda.tests import *
|
||||
|
||||
class TestAccountController(TestController):
|
||||
|
||||
def test_index(self):
|
||||
response = self.app.get(url_for(controller='account'))
|
||||
# Test response...
|
7
trunk/yolanda/tests/functional/test_index.py
Normal file
7
trunk/yolanda/tests/functional/test_index.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from yolanda.tests import *
|
||||
|
||||
class TestIndexController(TestController):
|
||||
|
||||
def test_index(self):
|
||||
response = self.app.get(url_for(controller='index'))
|
||||
# Test response...
|
7
trunk/yolanda/tests/functional/test_search.py
Normal file
7
trunk/yolanda/tests/functional/test_search.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from yolanda.tests import *
|
||||
|
||||
class TestSearchController(TestController):
|
||||
|
||||
def test_index(self):
|
||||
response = self.app.get(url_for(controller='search'))
|
||||
# Test response...
|
7
trunk/yolanda/tests/functional/test_video.py
Normal file
7
trunk/yolanda/tests/functional/test_video.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from yolanda.tests import *
|
||||
|
||||
class TestVideoController(TestController):
|
||||
|
||||
def test_index(self):
|
||||
response = self.app.get(url_for(controller='video'))
|
||||
# Test response...
|
0
trunk/yolanda/tests/test_models.py
Normal file
0
trunk/yolanda/tests/test_models.py
Normal file
14
trunk/yolanda/websetup.py
Normal file
14
trunk/yolanda/websetup.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
"""Setup the Yolanda application"""
|
||||
import logging
|
||||
|
||||
from paste.deploy import appconfig
|
||||
from pylons import config
|
||||
|
||||
from yolanda.config.environment import load_environment
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def setup_config(command, filename, section, vars):
|
||||
"""Place any commands to setup yolanda here"""
|
||||
conf = appconfig('config:' + filename)
|
||||
load_environment(conf.global_conf, conf.local_conf)
|
Loading…
Reference in a new issue