summaryrefslogtreecommitdiffstats
path: root/funcweb
diff options
context:
space:
mode:
authorLuke Macken <lmacken@redhat.com>2008-01-17 11:13:22 -0500
committerLuke Macken <lmacken@redhat.com>2008-01-17 11:13:22 -0500
commitc498c67ed6bd18be1d54f884099df10b1db06509 (patch)
treedb1dd0fba37babcec610421e5857ad3a22f29e62 /funcweb
parentaee6076dd78dfb1b88ab4d369e24fb1bbf710816 (diff)
downloadthird_party-func-c498c67ed6bd18be1d54f884099df10b1db06509.tar.gz
third_party-func-c498c67ed6bd18be1d54f884099df10b1db06509.tar.xz
third_party-func-c498c67ed6bd18be1d54f884099df10b1db06509.zip
Initial `tg-admin quickstart` of funcweb
Diffstat (limited to 'funcweb')
-rw-r--r--funcweb/README.txt4
-rw-r--r--funcweb/dev.cfg66
-rw-r--r--funcweb/funcweb.egg-info/PKG-INFO15
-rw-r--r--funcweb/funcweb.egg-info/SOURCES.txt21
-rw-r--r--funcweb/funcweb.egg-info/dependency_links.txt1
-rw-r--r--funcweb/funcweb.egg-info/not-zip-safe1
-rw-r--r--funcweb/funcweb.egg-info/paster_plugins.txt2
-rw-r--r--funcweb/funcweb.egg-info/requires.txt1
-rw-r--r--funcweb/funcweb.egg-info/sqlobject.txt2
-rw-r--r--funcweb/funcweb.egg-info/top_level.txt1
-rw-r--r--funcweb/funcweb/__init__.py0
-rw-r--r--funcweb/funcweb/config/__init__.py0
-rw-r--r--funcweb/funcweb/config/app.cfg52
-rw-r--r--funcweb/funcweb/config/log.cfg29
-rw-r--r--funcweb/funcweb/controllers.py12
-rw-r--r--funcweb/funcweb/json.py10
-rw-r--r--funcweb/funcweb/model.py9
-rw-r--r--funcweb/funcweb/release.py14
-rw-r--r--funcweb/funcweb/static/css/style.css134
-rw-r--r--funcweb/funcweb/static/images/favicon.icobin0 -> 1081 bytes
-rw-r--r--funcweb/funcweb/static/images/header_inner.pngbin0 -> 37537 bytes
-rw-r--r--funcweb/funcweb/static/images/info.pngbin0 -> 2889 bytes
-rw-r--r--funcweb/funcweb/static/images/ok.pngbin0 -> 25753 bytes
-rw-r--r--funcweb/funcweb/static/images/tg_under_the_hood.pngbin0 -> 4010 bytes
-rw-r--r--funcweb/funcweb/static/images/under_the_hood_blue.pngbin0 -> 2667 bytes
-rw-r--r--funcweb/funcweb/templates/__init__.py0
-rw-r--r--funcweb/funcweb/templates/login.kid114
-rw-r--r--funcweb/funcweb/templates/master.kid47
-rw-r--r--funcweb/funcweb/templates/welcome.kid47
-rw-r--r--funcweb/funcweb/tests/__init__.py0
-rw-r--r--funcweb/funcweb/tests/test_controllers.py32
-rw-r--r--funcweb/funcweb/tests/test_model.py22
-rw-r--r--funcweb/sample-prod.cfg84
-rw-r--r--funcweb/setup.py69
-rwxr-xr-xfuncweb/start-funcweb.py25
-rw-r--r--funcweb/test.cfg4
36 files changed, 818 insertions, 0 deletions
diff --git a/funcweb/README.txt b/funcweb/README.txt
new file mode 100644
index 0000000..36f4928
--- /dev/null
+++ b/funcweb/README.txt
@@ -0,0 +1,4 @@
+funcweb
+
+This is a TurboGears (http://www.turbogears.org) project. It can be
+started by running the start-funcweb.py script. \ No newline at end of file
diff --git a/funcweb/dev.cfg b/funcweb/dev.cfg
new file mode 100644
index 0000000..77efc8c
--- /dev/null
+++ b/funcweb/dev.cfg
@@ -0,0 +1,66 @@
+[global]
+# This is where all of your settings go for your development environment
+# Settings that are the same for both development and production
+# (such as template engine, encodings, etc.) all go in
+# funcweb/config/app.cfg
+
+# DATABASE
+
+# pick the form for your database
+# sqlobject.dburi="postgres://username@hostname/databasename"
+# sqlobject.dburi="mysql://username:password@hostname:port/databasename"
+# sqlobject.dburi="sqlite:///file_name_and_path"
+
+# If you have sqlite, here's a simple default to get you started
+# in development
+sqlobject.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite"
+
+
+# if you are using a database or table type without transactions
+# (MySQL default, for example), you should turn off transactions
+# by prepending notrans_ on the uri
+# sqlobject.dburi="notrans_mysql://username:password@hostname:port/databasename"
+
+# for Windows users, sqlite URIs look like:
+# sqlobject.dburi="sqlite:///drive_letter:/path/to/file"
+
+# SERVER
+
+# Some server parameters that you may want to tweak
+# server.socket_port=8080
+
+# Enable the debug output at the end on pages.
+# log_debug_info_filter.on = False
+
+server.environment="development"
+autoreload.package="funcweb"
+
+# Auto-Reload after code modification
+# autoreload.on = True
+
+# Set to True if you'd like to abort execution if a controller gets an
+# unexpected parameter. False by default
+tg.strict_parameters = True
+
+# LOGGING
+# Logging configuration generally follows the style of the standard
+# Python logging module configuration. Note that when specifying
+# log format messages, you need to use *() for formatting variables.
+# Deployment independent log configuration is in funcweb/config/log.cfg
+[logging]
+
+[[loggers]]
+[[[funcweb]]]
+level='DEBUG'
+qualname='funcweb'
+handlers=['debug_out']
+
+[[[allinfo]]]
+level='INFO'
+handlers=['debug_out']
+
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
diff --git a/funcweb/funcweb.egg-info/PKG-INFO b/funcweb/funcweb.egg-info/PKG-INFO
new file mode 100644
index 0000000..c355bdb
--- /dev/null
+++ b/funcweb/funcweb.egg-info/PKG-INFO
@@ -0,0 +1,15 @@
+Metadata-Version: 1.0
+Name: funcweb
+Version: 1.0
+Summary: UNKNOWN
+Home-page: UNKNOWN
+Author: UNKNOWN
+Author-email: UNKNOWN
+License: UNKNOWN
+Description: UNKNOWN
+Platform: UNKNOWN
+Classifier: Development Status :: 3 - Alpha
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Framework :: TurboGears
diff --git a/funcweb/funcweb.egg-info/SOURCES.txt b/funcweb/funcweb.egg-info/SOURCES.txt
new file mode 100644
index 0000000..f1147f3
--- /dev/null
+++ b/funcweb/funcweb.egg-info/SOURCES.txt
@@ -0,0 +1,21 @@
+README.txt
+setup.py
+start-funcweb.py
+funcweb/__init__.py
+funcweb/controllers.py
+funcweb/json.py
+funcweb/model.py
+funcweb/release.py
+funcweb.egg-info/PKG-INFO
+funcweb.egg-info/SOURCES.txt
+funcweb.egg-info/dependency_links.txt
+funcweb.egg-info/not-zip-safe
+funcweb.egg-info/paster_plugins.txt
+funcweb.egg-info/requires.txt
+funcweb.egg-info/sqlobject.txt
+funcweb.egg-info/top_level.txt
+funcweb/config/__init__.py
+funcweb/templates/__init__.py
+funcweb/tests/__init__.py
+funcweb/tests/test_controllers.py
+funcweb/tests/test_model.py
diff --git a/funcweb/funcweb.egg-info/dependency_links.txt b/funcweb/funcweb.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/funcweb/funcweb.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/funcweb/funcweb.egg-info/not-zip-safe b/funcweb/funcweb.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/funcweb/funcweb.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/funcweb/funcweb.egg-info/paster_plugins.txt b/funcweb/funcweb.egg-info/paster_plugins.txt
new file mode 100644
index 0000000..14fec70
--- /dev/null
+++ b/funcweb/funcweb.egg-info/paster_plugins.txt
@@ -0,0 +1,2 @@
+TurboGears
+PasteScript
diff --git a/funcweb/funcweb.egg-info/requires.txt b/funcweb/funcweb.egg-info/requires.txt
new file mode 100644
index 0000000..df5d977
--- /dev/null
+++ b/funcweb/funcweb.egg-info/requires.txt
@@ -0,0 +1 @@
+TurboGears >= 1.0.3.2 \ No newline at end of file
diff --git a/funcweb/funcweb.egg-info/sqlobject.txt b/funcweb/funcweb.egg-info/sqlobject.txt
new file mode 100644
index 0000000..ab2de8d
--- /dev/null
+++ b/funcweb/funcweb.egg-info/sqlobject.txt
@@ -0,0 +1,2 @@
+db_module=funcweb.model
+history_dir=$base/funcweb/sqlobject-history
diff --git a/funcweb/funcweb.egg-info/top_level.txt b/funcweb/funcweb.egg-info/top_level.txt
new file mode 100644
index 0000000..a443101
--- /dev/null
+++ b/funcweb/funcweb.egg-info/top_level.txt
@@ -0,0 +1 @@
+funcweb
diff --git a/funcweb/funcweb/__init__.py b/funcweb/funcweb/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funcweb/funcweb/__init__.py
diff --git a/funcweb/funcweb/config/__init__.py b/funcweb/funcweb/config/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funcweb/funcweb/config/__init__.py
diff --git a/funcweb/funcweb/config/app.cfg b/funcweb/funcweb/config/app.cfg
new file mode 100644
index 0000000..5734a78
--- /dev/null
+++ b/funcweb/funcweb/config/app.cfg
@@ -0,0 +1,52 @@
+[global]
+# The settings in this file should not vary depending on the deployment
+# environment. dev.cfg and prod.cfg are the locations for
+# the different deployment settings. Settings in this file will
+# be overridden by settings in those other files.
+
+# The commented out values below are the defaults
+
+# VIEW
+
+# which view (template engine) to use if one is not specified in the
+# template name
+# tg.defaultview = "kid"
+
+# The following kid settings determine the settings used by the kid serializer.
+
+# Kid output method (e.g. html, html-strict, xhtml, xhtml-strict, xml, json)
+# and formatting (e.g. default, straight, compact, newlines, wrap, nice)
+# kid.outputformat="html default"
+
+# kid.encoding="utf-8"
+
+# The sitetemplate is used for overall styling of a site that
+# includes multiple TurboGears applications
+# tg.sitetemplate="<packagename.templates.templatename>"
+
+# Allow every exposed function to be called as json,
+# tg.allow_json = False
+
+# List of Widgets to include on every page.
+# for exemple ['turbogears.mochikit']
+# tg.include_widgets = []
+
+# Set to True if the scheduler should be started
+# tg.scheduler = False
+
+# Set session or cookie
+# session_filter.on = True
+
+
+# compress the data sends to the web browser
+# [/]
+# gzip_filter.on = True
+# gzip_filter.mime_types = ["application/x-javascript", "text/javascript", "text/html", "text/css", "text/plain"]
+
+[/static]
+static_filter.on = True
+static_filter.dir = "%(top_level_dir)s/static"
+
+[/favicon.ico]
+static_filter.on = True
+static_filter.file = "%(top_level_dir)s/static/images/favicon.ico"
diff --git a/funcweb/funcweb/config/log.cfg b/funcweb/funcweb/config/log.cfg
new file mode 100644
index 0000000..ce776f8
--- /dev/null
+++ b/funcweb/funcweb/config/log.cfg
@@ -0,0 +1,29 @@
+# LOGGING
+# Logging is often deployment specific, but some handlers and
+# formatters can be defined here.
+
+[logging]
+[[formatters]]
+[[[message_only]]]
+format='*(message)s'
+
+[[[full_content]]]
+format='*(asctime)s *(name)s *(levelname)s *(message)s'
+
+[[handlers]]
+[[[debug_out]]]
+class='StreamHandler'
+level='DEBUG'
+args='(sys.stdout,)'
+formatter='full_content'
+
+[[[access_out]]]
+class='StreamHandler'
+level='INFO'
+args='(sys.stdout,)'
+formatter='message_only'
+
+[[[error_out]]]
+class='StreamHandler'
+level='ERROR'
+args='(sys.stdout,)'
diff --git a/funcweb/funcweb/controllers.py b/funcweb/funcweb/controllers.py
new file mode 100644
index 0000000..5206727
--- /dev/null
+++ b/funcweb/funcweb/controllers.py
@@ -0,0 +1,12 @@
+from turbogears import controllers, expose, flash
+# from model import *
+# import logging
+# log = logging.getLogger("funcweb.controllers")
+
+class Root(controllers.RootController):
+ @expose(template="funcweb.templates.welcome")
+ def index(self):
+ import time
+ # log.debug("Happy TurboGears Controller Responding For Duty")
+ flash("Your application is now running")
+ return dict(now=time.ctime())
diff --git a/funcweb/funcweb/json.py b/funcweb/funcweb/json.py
new file mode 100644
index 0000000..66d5cfb
--- /dev/null
+++ b/funcweb/funcweb/json.py
@@ -0,0 +1,10 @@
+# A JSON-based API(view) for your app.
+# Most rules would look like:
+# @jsonify.when("isinstance(obj, YourClass)")
+# def jsonify_yourclass(obj):
+# return [obj.val1, obj.val2]
+# @jsonify can convert your objects to following types:
+# lists, dicts, numbers and strings
+
+from turbojson.jsonify import jsonify
+
diff --git a/funcweb/funcweb/model.py b/funcweb/funcweb/model.py
new file mode 100644
index 0000000..28f2b02
--- /dev/null
+++ b/funcweb/funcweb/model.py
@@ -0,0 +1,9 @@
+from turbogears.database import PackageHub
+from sqlobject import *
+
+hub = PackageHub('funcweb')
+__connection__ = hub
+
+# class YourDataClass(SQLObject):
+# pass
+
diff --git a/funcweb/funcweb/release.py b/funcweb/funcweb/release.py
new file mode 100644
index 0000000..94244db
--- /dev/null
+++ b/funcweb/funcweb/release.py
@@ -0,0 +1,14 @@
+# Release information about funcweb
+
+version = "1.0"
+
+# description = "Your plan to rule the world"
+# long_description = "More description about your plan"
+# author = "Your Name Here"
+# email = "YourEmail@YourDomain"
+# copyright = "Vintage 2006 - a good year indeed"
+
+# if it's open source, you might want to specify these
+# url = "http://yourcool.site/"
+# download_url = "http://yourcool.site/download"
+# license = "MIT"
diff --git a/funcweb/funcweb/static/css/style.css b/funcweb/funcweb/static/css/style.css
new file mode 100644
index 0000000..c98d40e
--- /dev/null
+++ b/funcweb/funcweb/static/css/style.css
@@ -0,0 +1,134 @@
+/*
+ * Quick mash-up of CSS for the TG quick start page.
+ */
+
+html, body {
+ color: black;
+ background-color: #ddd;
+ font: x-small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
+ margin: 0;
+ padding: 0;
+}
+
+td, th {padding:3px;border:none;}
+tr th {text-align:left;background-color:#f0f0f0;color:#333;}
+tr.odd td {background-color:#edf3fe;}
+tr.even td {background-color:#fff;}
+
+#header {
+ height: 80px;
+ width: 777px;
+ background: blue URL('../images/header_inner.png') no-repeat;
+ border-left: 1px solid #aaa;
+ border-right: 1px solid #aaa;
+ margin: 0 auto 0 auto;
+}
+
+a.link, a, a.active {
+ color: #369;
+}
+
+
+#main_content {
+ color: black;
+ font-size: 127%;
+ background-color: white;
+ width: 757px;
+ margin: 0 auto 0 auto;
+ border-left: 1px solid #aaa;
+ border-right: 1px solid #aaa;
+ padding: 10px;
+}
+
+#sidebar {
+ border: 1px solid #aaa;
+ background-color: #eee;
+ margin: 0.5em;
+ padding: 1em;
+ float: right;
+ width: 200px;
+ font-size: 88%;
+}
+
+#sidebar h2 {
+ margin-top: 0;
+}
+
+#sidebar ul {
+ margin-left: 1.5em;
+ padding-left: 0;
+}
+
+h1,h2,h3,h4,h5,h6,#getting_started_steps {
+ font-family: "Century Schoolbook L", Georgia, serif;
+ font-weight: bold;
+}
+
+h2 {
+ font-size: 150%;
+}
+
+#getting_started_steps a {
+ text-decoration: none;
+}
+
+#getting_started_steps a:hover {
+ text-decoration: underline;
+}
+
+#getting_started_steps li {
+ font-size: 80%;
+ margin-bottom: 0.5em;
+}
+
+#getting_started_steps h2 {
+ font-size: 120%;
+}
+
+#getting_started_steps p {
+ font: 100% "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
+}
+
+#footer {
+ border: 1px solid #aaa;
+ border-top: 0px none;
+ color: #999;
+ background-color: white;
+ padding: 10px;
+ font-size: 80%;
+ text-align: center;
+ width: 757px;
+ margin: 0 auto 1em auto;
+}
+
+.code {
+ font-family: monospace;
+}
+
+span.code {
+ font-weight: bold;
+ background: #eee;
+}
+
+#status_block {
+ margin: 0 auto 0.5em auto;
+ padding: 15px 10px 15px 55px;
+ background: #cec URL('../images/ok.png') left center no-repeat;
+ border: 1px solid #9c9;
+ width: 450px;
+ font-size: 120%;
+ font-weight: bolder;
+}
+
+.notice {
+ margin: 0.5em auto 0.5em auto;
+ padding: 15px 10px 15px 55px;
+ width: 450px;
+ background: #eef URL('../images/info.png') left center no-repeat;
+ border: 1px solid #cce;
+}
+
+.fielderror {
+ color: red;
+ font-weight: bold;
+} \ No newline at end of file
diff --git a/funcweb/funcweb/static/images/favicon.ico b/funcweb/funcweb/static/images/favicon.ico
new file mode 100644
index 0000000..332557b
--- /dev/null
+++ b/funcweb/funcweb/static/images/favicon.ico
Binary files differ
diff --git a/funcweb/funcweb/static/images/header_inner.png b/funcweb/funcweb/static/images/header_inner.png
new file mode 100644
index 0000000..2b2d87d
--- /dev/null
+++ b/funcweb/funcweb/static/images/header_inner.png
Binary files differ
diff --git a/funcweb/funcweb/static/images/info.png b/funcweb/funcweb/static/images/info.png
new file mode 100644
index 0000000..329c523
--- /dev/null
+++ b/funcweb/funcweb/static/images/info.png
Binary files differ
diff --git a/funcweb/funcweb/static/images/ok.png b/funcweb/funcweb/static/images/ok.png
new file mode 100644
index 0000000..fee6751
--- /dev/null
+++ b/funcweb/funcweb/static/images/ok.png
Binary files differ
diff --git a/funcweb/funcweb/static/images/tg_under_the_hood.png b/funcweb/funcweb/static/images/tg_under_the_hood.png
new file mode 100644
index 0000000..bc9c79c
--- /dev/null
+++ b/funcweb/funcweb/static/images/tg_under_the_hood.png
Binary files differ
diff --git a/funcweb/funcweb/static/images/under_the_hood_blue.png b/funcweb/funcweb/static/images/under_the_hood_blue.png
new file mode 100644
index 0000000..90e84b7
--- /dev/null
+++ b/funcweb/funcweb/static/images/under_the_hood_blue.png
Binary files differ
diff --git a/funcweb/funcweb/templates/__init__.py b/funcweb/funcweb/templates/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funcweb/funcweb/templates/__init__.py
diff --git a/funcweb/funcweb/templates/login.kid b/funcweb/funcweb/templates/login.kid
new file mode 100644
index 0000000..4fd6755
--- /dev/null
+++ b/funcweb/funcweb/templates/login.kid
@@ -0,0 +1,114 @@
+<!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"
+ xmlns:py="http://purl.org/kid/ns#">
+
+<head>
+ <meta content="text/html; charset=UTF-8"
+ http-equiv="content-type" py:replace="''"/>
+ <title>Login</title>
+ <style type="text/css">
+ #loginBox
+ {
+ width: 30%;
+ margin: auto;
+ margin-top: 10%;
+ padding-left: 10%;
+ padding-right: 10%;
+ padding-top: 5%;
+ padding-bottom: 5%;
+ font-family: verdana;
+ font-size: 10px;
+ background-color: #eee;
+ border: 2px solid #ccc;
+ }
+
+ #loginBox h1
+ {
+ font-size: 42px;
+ font-family: "Trebuchet MS";
+ margin: 0;
+ color: #ddd;
+ }
+
+ #loginBox p
+ {
+ position: relative;
+ top: -1.5em;
+ padding-left: 4em;
+ font-size: 12px;
+ margin: 0;
+ color: #666;
+ }
+
+ #loginBox table
+ {
+ table-layout: fixed;
+ border-spacing: 0;
+ width: 100%;
+ }
+
+ #loginBox td.label
+ {
+ width: 33%;
+ text-align: right;
+ }
+
+ #loginBox td.field
+ {
+ width: 66%;
+ }
+
+ #loginBox td.field input
+ {
+ width: 100%;
+ }
+
+ #loginBox td.buttons
+ {
+ text-align: right;
+ }
+
+ </style>
+</head>
+
+<body>
+ <div id="loginBox">
+ <h1>Login</h1>
+ <p>${message}</p>
+ <form action="${previous_url}" method="POST">
+ <table>
+ <tr>
+ <td class="label">
+ <label for="user_name">User Name:</label>
+ </td>
+ <td class="field">
+ <input type="text" id="user_name" name="user_name"/>
+ </td>
+ </tr>
+ <tr>
+ <td class="label">
+ <label for="password">Password:</label>
+ </td>
+ <td class="field">
+ <input type="password" id="password" name="password"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="buttons">
+ <input type="submit" name="login" value="Login"/>
+ </td>
+ </tr>
+ </table>
+
+ <input py:if="forward_url" type="hidden" name="forward_url"
+ value="${forward_url}"/>
+
+ <div py:for="name,values in original_parameters.items()" py:strip="1">
+ <input py:for="value in isinstance(values, list) and values or [values]"
+ type="hidden" name="${name}" value="${value}"/>
+ </div>
+ </form>
+ </div>
+</body>
+</html>
diff --git a/funcweb/funcweb/templates/master.kid b/funcweb/funcweb/templates/master.kid
new file mode 100644
index 0000000..1b9841a
--- /dev/null
+++ b/funcweb/funcweb/templates/master.kid
@@ -0,0 +1,47 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<?python import sitetemplate ?>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="sitetemplate">
+
+<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="item.items()">
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
+ <title py:replace="''">Your title goes here</title>
+ <meta py:replace="item[:]"/>
+ <style type="text/css">
+ #pageLogin
+ {
+ font-size: 10px;
+ font-family: verdana;
+ text-align: right;
+ }
+ </style>
+ <style type="text/css" media="screen">
+@import "${tg.url('/static/css/style.css')}";
+</style>
+</head>
+
+<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
+ <div py:if="tg.config('identity.on') and not defined('logging_in')" id="pageLogin">
+ <span py:if="tg.identity.anonymous">
+ <a href="${tg.url('/login')}">Login</a>
+ </span>
+ <span py:if="not tg.identity.anonymous">
+ Welcome ${tg.identity.user.display_name}.
+ <a href="${tg.url('/logout')}">Logout</a>
+ </span>
+ </div>
+ <div id="header">&nbsp;</div>
+ <div id="main_content">
+ <div id="status_block" class="flash" py:if="value_of('tg_flash', None)" py:content="tg_flash"></div>
+
+ <div py:replace="[item.text]+item[:]"/>
+
+ <!-- End of main_content -->
+ </div>
+<div id="footer"> <img src="${tg.url('/static/images/under_the_hood_blue.png')}" alt="TurboGears under the hood" />
+ <p>TurboGears is a open source front-to-back web development
+ framework written in Python</p>
+ <p>Copyright &copy; 2007 Kevin Dangoor</p>
+</div>
+</body>
+
+</html>
diff --git a/funcweb/funcweb/templates/welcome.kid b/funcweb/funcweb/templates/welcome.kid
new file mode 100644
index 0000000..9095267
--- /dev/null
+++ b/funcweb/funcweb/templates/welcome.kid
@@ -0,0 +1,47 @@
+<!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" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
+<head>
+<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
+<title>Welcome to TurboGears</title>
+</head>
+<body>
+
+ <div id="sidebar">
+ <h2>Learn more</h2>
+ Learn more about TurboGears and take part in its
+ development
+ <ul class="links">
+ <li><a href="http://www.turbogears.org">Official website</a></li>
+ <li><a href="http://docs.turbogears.org">Documentation</a></li>
+ <li><a href="http://trac.turbogears.org/turbogears/">Trac
+ (bugs/suggestions)</a></li>
+ <li><a href="http://groups.google.com/group/turbogears"> Mailing list</a> </li>
+ </ul>
+ <span py:replace="now">now</span>
+ </div>
+ <div id="getting_started">
+ <ol id="getting_started_steps">
+ <li class="getting_started">
+ <h3>Model</h3>
+ <p> <a href="http://docs.turbogears.org/1.0/GettingStarted/DefineDatabase">Design models</a> in the <span class="code">model.py</span>.<br/>
+ Edit <span class="code">dev.cfg</span> to <a href="http://docs.turbogears.org/1.0/GettingStarted/UseDatabase">use a different backend</a>, or start with a pre-configured SQLite database. <br/>
+ Use script <span class="code">tg-admin sql create</span> to create the database tables.</p>
+ </li>
+ <li class="getting_started">
+ <h3>View</h3>
+ <p> Edit <a href="http://docs.turbogears.org/1.0/GettingStarted/Kid">html-like templates</a> in the <span class="code">/templates</span> folder;<br/>
+ Put all <a href="http://docs.turbogears.org/1.0/StaticFiles">static contents</a> in the <span class="code">/static</span> folder. </p>
+ </li>
+ <li class="getting_started">
+ <h3>Controller</h3>
+ <p> Edit <span class="code"> controllers.py</span> and <a href="http://docs.turbogears.org/1.0/GettingStarted/CherryPy">build your
+ website structure</a> with the simplicity of Python objects. <br/>
+ TurboGears will automatically reload itself when you modify your project. </p>
+ </li>
+ </ol>
+ <div class="notice"> If you create something cool, please <a href="http://groups.google.com/group/turbogears">let people know</a>, and consider contributing something back to the <a href="http://groups.google.com/group/turbogears">community</a>.</div>
+ </div>
+ <!-- End of getting_started -->
+</body>
+</html>
diff --git a/funcweb/funcweb/tests/__init__.py b/funcweb/funcweb/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/funcweb/funcweb/tests/__init__.py
diff --git a/funcweb/funcweb/tests/test_controllers.py b/funcweb/funcweb/tests/test_controllers.py
new file mode 100644
index 0000000..3c26c58
--- /dev/null
+++ b/funcweb/funcweb/tests/test_controllers.py
@@ -0,0 +1,32 @@
+import unittest
+import turbogears
+from turbogears import testutil
+from funcweb.controllers import Root
+import cherrypy
+
+cherrypy.root = Root()
+
+class TestPages(unittest.TestCase):
+
+ def setUp(self):
+ turbogears.startup.startTurboGears()
+
+ def tearDown(self):
+ """Tests for apps using identity need to stop CP/TG after each test to
+ stop the VisitManager thread.
+ See http://trac.turbogears.org/turbogears/ticket/1217 for details.
+ """
+ turbogears.startup.stopTurboGears()
+
+ def test_method(self):
+ "the index method should return a string called now"
+ import types
+ result = testutil.call(cherrypy.root.index)
+ assert type(result["now"]) == types.StringType
+
+ def test_indextitle(self):
+ "The indexpage should have the right title"
+ testutil.createRequest("/")
+ response = cherrypy.response.body[0].lower()
+ assert "<title>welcome to turbogears</title>" in response
+
diff --git a/funcweb/funcweb/tests/test_model.py b/funcweb/funcweb/tests/test_model.py
new file mode 100644
index 0000000..903c2d8
--- /dev/null
+++ b/funcweb/funcweb/tests/test_model.py
@@ -0,0 +1,22 @@
+# If your project uses a database, you can set up database tests
+# similar to what you see below. Be sure to set the db_uri to
+# an appropriate uri for your testing database. sqlite is a good
+# choice for testing, because you can use an in-memory database
+# which is very fast.
+
+from turbogears import testutil, database
+# from funcweb.model import YourDataClass, User
+
+# database.set_db_uri("sqlite:///:memory:")
+
+# class TestUser(testutil.DBTest):
+# def get_model(self):
+# return User
+# def test_creation(self):
+# "Object creation should set the name"
+# obj = User(user_name = "creosote",
+# email_address = "spam@python.not",
+# display_name = "Mr Creosote",
+# password = "Wafer-thin Mint")
+# assert obj.display_name == "Mr Creosote"
+
diff --git a/funcweb/sample-prod.cfg b/funcweb/sample-prod.cfg
new file mode 100644
index 0000000..6ca2b4e
--- /dev/null
+++ b/funcweb/sample-prod.cfg
@@ -0,0 +1,84 @@
+[global]
+# This is where all of your settings go for your production environment.
+# You'll copy this file over to your production server and provide it
+# as a command-line option to your start script.
+# Settings that are the same for both development and production
+# (such as template engine, encodings, etc.) all go in
+# funcweb/config/app.cfg
+
+# DATABASE
+
+# pick the form for your database
+# sqlobject.dburi="postgres://username@hostname/databasename"
+# sqlobject.dburi="mysql://username:password@hostname:port/databasename"
+# sqlobject.dburi="sqlite:///file_name_and_path"
+
+# If you have sqlite, here's a simple default to get you started
+# in development
+sqlobject.dburi="sqlite://%(current_dir_uri)s/devdata.sqlite"
+
+
+# if you are using a database or table type without transactions
+# (MySQL default, for example), you should turn off transactions
+# by prepending notrans_ on the uri
+# sqlobject.dburi="notrans_mysql://username:password@hostname:port/databasename"
+
+# for Windows users, sqlite URIs look like:
+# sqlobject.dburi="sqlite:///drive_letter:/path/to/file"
+
+
+# SERVER
+
+server.environment="production"
+
+# Sets the number of threads the server uses
+# server.thread_pool = 1
+
+# if this is part of a larger site, you can set the path
+# to the TurboGears instance here
+# server.webpath=""
+
+# Set to True if you are deploying your App behind a proxy
+# e.g. Apache using mod_proxy
+# base_url_filter.on = False
+
+# Set to True if your proxy adds the x_forwarded_host header
+# base_url_filter.use_x_forwarded_host = True
+
+# If your proxy does not add the x_forwarded_host header, set
+# the following to the *public* host url.
+# (Note: This will be overridden by the use_x_forwarded_host option
+# if it is set to True and the proxy adds the header correctly.
+# base_url_filter.base_url = "http://www.example.com"
+
+# Set to True if you'd like to abort execution if a controller gets an
+# unexpected parameter. False by default
+# tg.strict_parameters = False
+
+# LOGGING
+# Logging configuration generally follows the style of the standard
+# Python logging module configuration. Note that when specifying
+# log format messages, you need to use *() for formatting variables.
+# Deployment independent log configuration is in funcweb/config/log.cfg
+[logging]
+
+[[handlers]]
+
+[[[access_out]]]
+# set the filename as the first argument below
+args="('server.log',)"
+class='FileHandler'
+level='INFO'
+formatter='message_only'
+
+[[loggers]]
+[[[funcweb]]]
+level='ERROR'
+qualname='funcweb'
+handlers=['error_out']
+
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
diff --git a/funcweb/setup.py b/funcweb/setup.py
new file mode 100644
index 0000000..40e86ee
--- /dev/null
+++ b/funcweb/setup.py
@@ -0,0 +1,69 @@
+from setuptools import setup, find_packages
+from turbogears.finddata import find_package_data
+
+import os
+execfile(os.path.join("funcweb", "release.py"))
+
+packages=find_packages()
+package_data = find_package_data(where='funcweb',
+ package='funcweb')
+if os.path.isdir('locales'):
+ packages.append('locales')
+ package_data.update(find_package_data(where='locales',
+ exclude=('*.po',), only_in_packages=False))
+
+setup(
+ name="funcweb",
+ version=version,
+
+ # uncomment the following lines if you fill them out in release.py
+ #description=description,
+ #author=author,
+ #author_email=email,
+ #url=url,
+ #download_url=download_url,
+ #license=license,
+
+ install_requires=[
+ "TurboGears >= 1.0.3.2",
+ ],
+ scripts=["start-funcweb.py"],
+ zip_safe=False,
+ packages=packages,
+ package_data=package_data,
+ keywords=[
+ # Use keywords if you'll be adding your package to the
+ # Python Cheeseshop
+
+ # if this has widgets, uncomment the next line
+ # 'turbogears.widgets',
+
+ # if this has a tg-admin command, uncomment the next line
+ # 'turbogears.command',
+
+ # if this has identity providers, uncomment the next line
+ # 'turbogears.identity.provider',
+
+ # If this is a template plugin, uncomment the next line
+ # 'python.templating.engines',
+
+ # If this is a full application, uncomment the next line
+ # 'turbogears.app',
+ ],
+ classifiers=[
+ 'Development Status :: 3 - Alpha',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Framework :: TurboGears',
+ # if this is an application that you'll distribute through
+ # the Cheeseshop, uncomment the next line
+ # 'Framework :: TurboGears :: Applications',
+
+ # if this is a package that includes widgets that you'll distribute
+ # through the Cheeseshop, uncomment the next line
+ # 'Framework :: TurboGears :: Widgets',
+ ],
+ test_suite='nose.collector',
+ )
+
diff --git a/funcweb/start-funcweb.py b/funcweb/start-funcweb.py
new file mode 100755
index 0000000..604cf19
--- /dev/null
+++ b/funcweb/start-funcweb.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+__requires__="TurboGears"
+import pkg_resources
+
+from turbogears import config, update_config, start_server
+import cherrypy
+cherrypy.lowercase_api = True
+from os.path import *
+import sys
+
+# first look on the command line for a desired config file,
+# if it's not on the command line, then
+# look for setup.py in this directory. If it's not there, this script is
+# probably installed
+if len(sys.argv) > 1:
+ update_config(configfile=sys.argv[1],
+ modulename="funcweb.config")
+elif exists(join(dirname(__file__), "setup.py")):
+ update_config(configfile="dev.cfg",modulename="funcweb.config")
+else:
+ update_config(configfile="prod.cfg",modulename="funcweb.config")
+config.update(dict(package="funcweb"))
+
+from funcweb.controllers import Root
+start_server(Root())
diff --git a/funcweb/test.cfg b/funcweb/test.cfg
new file mode 100644
index 0000000..df909c9
--- /dev/null
+++ b/funcweb/test.cfg
@@ -0,0 +1,4 @@
+# You can place test-specific configuration options here (like test db uri, etc)
+
+sqlobject.dburi = "sqlite:///:memory:"
+