Mostly upgrade to turbogears 1.0b1
authorAaron Bentley <abentley@panoramicfeedback.com>
Tue, 5 Dec 2006 21:08:03 +0000 (16:08 -0500)
committerAaron Bentley <abentley@panoramicfeedback.com>
Tue, 5 Dec 2006 21:08:03 +0000 (16:08 -0500)
24 files changed:
Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/SOURCES.txt [new file with mode: 0644]
Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/dependency_links.txt [new file with mode: 0644]
Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/not-zip-safe [new file with mode: 0644]
Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/requires.txt
Bugs-Everywhere-Web/beweb/config/app.cfg [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/config/log.cfg [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/controllers.py
Bugs-Everywhere-Web/beweb/json.py [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/model.py
Bugs-Everywhere-Web/beweb/release.py
Bugs-Everywhere-Web/beweb/static/css/style.css
Bugs-Everywhere-Web/beweb/static/images/header_inner.png [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/static/images/info.png [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/static/images/ok.png [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/static/images/tg_under_the_hood.png [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png [new file with mode: 0644]
Bugs-Everywhere-Web/beweb/templates/login.kid
Bugs-Everywhere-Web/beweb/templates/master.kid
Bugs-Everywhere-Web/beweb/templates/welcome.kid
Bugs-Everywhere-Web/beweb/tests/test_model.py
Bugs-Everywhere-Web/dev.cfg
Bugs-Everywhere-Web/sample-prod.cfg [new file with mode: 0644]
Bugs-Everywhere-Web/setup.py
Bugs-Everywhere-Web/start-beweb.py

diff --git a/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/SOURCES.txt b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/SOURCES.txt
new file mode 100644 (file)
index 0000000..ab62ee4
--- /dev/null
@@ -0,0 +1,44 @@
+README.txt
+setup.py
+start-beweb.py
+Bugs_Everywhere_Web.egg-info/PKG-INFO
+Bugs_Everywhere_Web.egg-info/SOURCES.txt
+Bugs_Everywhere_Web.egg-info/dependency_links.txt
+Bugs_Everywhere_Web.egg-info/not-zip-safe
+Bugs_Everywhere_Web.egg-info/paster_plugins.txt
+Bugs_Everywhere_Web.egg-info/requires.txt
+Bugs_Everywhere_Web.egg-info/sqlobject.txt
+Bugs_Everywhere_Web.egg-info/top_level.txt
+Bugs_Everywhere_Web.egg-info/Bugs-Everywhere-Web.egg-info/SOURCES.txt
+Bugs_Everywhere_Web.egg-info/Bugs-Everywhere-Web.egg-info/not-zip-safe
+Bugs_Everywhere_Web.egg-info/Bugs-Everywhere-Web.egg-info/requires.txt
+Bugs_Everywhere_Web.egg-info/Bugs-Everywhere-Web.egg-info/sqlobject.txt
+Bugs_Everywhere_Web.egg-info/Bugs-Everywhere-Web.egg-info/top_level.txt
+beweb/__init__.py
+beweb/config.py
+beweb/controllers.py
+beweb/formatting.py
+beweb/json.py
+beweb/model.py
+beweb/prest.py
+beweb/release.py
+beweb/config/__init__.py
+beweb/templates/__init__.py
+beweb/tests/__init__.py
+beweb/tests/test_controllers.py
+beweb/tests/test_model.py
+libbe/__init__.py
+libbe/arch.py
+libbe/bugdir.py
+libbe/bzr.py
+libbe/cmdutil.py
+libbe/config.py
+libbe/diff.py
+libbe/mapfile.py
+libbe/names.py
+libbe/no_rcs.py
+libbe/plugin.py
+libbe/rcs.py
+libbe/restconvert.py
+libbe/tests.py
+libbe/utility.py
diff --git a/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/dependency_links.txt b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/dependency_links.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/not-zip-safe b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/not-zip-safe
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
index b4e1d25de188d6497fee6e93b0557657f3f7de7c..5fd6f712c7acfbbdf100cd87d526a026df1a33df 100644 (file)
@@ -1 +1 @@
-TurboGears >= 0.8a4
\ No newline at end of file
+TurboGears >= 1.0b1
\ No newline at end of file
diff --git a/Bugs-Everywhere-Web/beweb/config/app.cfg b/Bugs-Everywhere-Web/beweb/config/app.cfg
new file mode 100644 (file)
index 0000000..d37cf67
--- /dev/null
@@ -0,0 +1,42 @@
+[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.
+
+# One of (html|xml|json)
+# kid.outputformat="html"
+
+# 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
+
+[/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/Bugs-Everywhere-Web/beweb/config/log.cfg b/Bugs-Everywhere-Web/beweb/config/log.cfg
new file mode 100644 (file)
index 0000000..ce776f8
--- /dev/null
@@ -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,)'
index 5f0046e0d3bc5c1e86c97f1dec7c595f9925e8bc..358e74ad220107c3d22c0d67433e207cc4d4f277 100644 (file)
@@ -1,12 +1,20 @@
-import turbogears
-from turbogears import controllers, expose, redirect, identity
+import logging
+
 import cherrypy
+import turbogears
+from turbogears import controllers, expose, validate, redirect, identity
+
 from libbe.bugdir import (tree_root, cmp_severity, new_bug, new_comment, 
                           NoRootEntry)
 from libbe import names
 from config import projects
 from prest import PrestHandler, provide_action
 
+
+from beweb import json
+
+log = logging.getLogger("beweb.controllers")
+
 def project_tree(project):
     try:
         return tree_root(projects[project][1])
diff --git a/Bugs-Everywhere-Web/beweb/json.py b/Bugs-Everywhere-Web/beweb/json.py
new file mode 100644 (file)
index 0000000..6e100c3
--- /dev/null
@@ -0,0 +1,13 @@
+# This module provides helper functions for the JSON part of your
+# view, if you are providing a JSON-based API for your app.
+
+# Here's what most rules would look like:
+# @jsonify.when("isinstance(obj, YourClass)")
+# def jsonify_yourclass(obj):
+#     return [obj.val1, obj.val2]
+#
+# The goal is to break your objects down into simple values:
+# lists, dicts, numbers and strings
+
+from turbojson.jsonify import jsonify
+
index 6a603bb510a4b57123ea0c6bc040807e7c482719..5537dae5140eee40ec86c3e4964ec1ef7a565399 100644 (file)
+from datetime import datetime
+
 from sqlobject import *
 from turbogears.database import PackageHub
-# Uncomment the following line if you wish to use Identity and SO_Provider
-from turbogears.identity.soprovider import TG_User, TG_Group, TG_Permission
 from turbogears import identity
 
 hub = PackageHub("beweb")
 __connection__ = hub
 
+class Visit(SQLObject):
+    class sqlmeta:
+        table = "visit"
+
+    visit_key = StringCol(length=40, alternateID=True,
+                          alternateMethodName="by_visit_key")
+    created = DateTimeCol(default=datetime.now)
+    expiry = DateTimeCol()
+
+    def lookup_visit(cls, visit_key):
+        try:
+            return cls.by_visit_key(visit_key)
+        except SQLObjectNotFound:
+            return None
+    lookup_visit = classmethod(lookup_visit)
+
+class VisitIdentity(SQLObject):
+    visit_key = StringCol(length=40, alternateID=True,
+                          alternateMethodName="by_visit_key")
+    user_id = IntCol()
+
+
+class Group(SQLObject):
+    """
+    An ultra-simple group definition.
+    """
+
+    # names like "Group", "Order" and "User" are reserved words in SQL
+    # so we set the name to something safe for SQL
+    class sqlmeta:
+        table = "tg_group"
+
+    group_name = UnicodeCol(length=16, alternateID=True,
+                            alternateMethodName="by_group_name")
+    display_name = UnicodeCol(length=255)
+    created = DateTimeCol(default=datetime.now)
+
+    # collection of all users belonging to this group
+    users = RelatedJoin("User", intermediateTable="user_group",
+                        joinColumn="group_id", otherColumn="user_id")
+
+    # collection of all permissions for this group
+    permissions = RelatedJoin("Permission", joinColumn="group_id", 
+                              intermediateTable="group_permission",
+                              otherColumn="permission_id")
+
+
+class User(SQLObject):
+    """
+    Reasonably basic User definition. Probably would want additional attributes.
+    """
+    # names like "Group", "Order" and "User" are reserved words in SQL
+    # so we set the name to something safe for SQL
+    class sqlmeta:
+        table = "tg_user"
+
+    child_name = UnicodeCol(length=255)
+    user_name = UnicodeCol(length=16, alternateID=True,
+                           alternateMethodName="by_user_name")
+    email_address = UnicodeCol(length=255, alternateID=True,
+                               alternateMethodName="by_email_address")
+    display_name = UnicodeCol(length=255)
+    password = UnicodeCol(length=40)
+    created = DateTimeCol(default=datetime.now)
+
+    # groups this user belongs to
+    groups = RelatedJoin("Group", intermediateTable="user_group",
+                         joinColumn="user_id", otherColumn="group_id")
+
+    def _get_permissions(self):
+        perms = set()
+        for g in self.groups:
+            perms = perms | set(g.permissions)
+        return perms
+
+    def _set_password(self, cleartext_password):
+        "Runs cleartext_password through the hash algorithm before saving."
+        hash = identity.encrypt_password(cleartext_password)
+        self._SO_set_password(hash)
+
+    def set_password_raw(self, password):
+        "Saves the password as-is to the database."
+        self._SO_set_password(password)
+
+
+
+class Permission(SQLObject):
+    permission_name = UnicodeCol(length=16, alternateID=True,
+                                 alternateMethodName="by_permission_name")
+    description = UnicodeCol(length=255)
+
+    groups = RelatedJoin("Group",
+                        intermediateTable="group_permission",
+                         joinColumn="permission_id", 
+                         otherColumn="group_id")
+
 def people_map():
-    return dict([(u.userId, u.displayName) for u in TG_User.select() if 
+    return dict([(u.userId, u.displayName) for u in User.select() if 
                 "fixbugs" in identity.current.permissions])
-
-# class YourDataClass(SQLObject):
-#     pass
index 023291263b8eba729abfd6d196cb49767c5bc103..9d64bf72843d2e1adc96abfcc5a0a10ad3dd76da 100644 (file)
@@ -3,6 +3,7 @@
 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"
index ada46f3d8b79a75441331c99e68f2ec921ae5184..6fe197fafa0e39f5d086967765a006f6b1ad024c 100644 (file)
-table
-{
-    background-color: black;
-}
-td
-{
-    background-color: white;
-}
-h1
-{
-    font-family: "Verdana";
-    font-weight: bold;
-    font-size: 120%;
-    margin-bottom:0;
-    color: #990;
-}
-
-tr.closed td
-{
-    background-color: #ccc;
-}
-tr.closedeven td
-{
-    background-color: #ccc;
-}
-tr.closedodd td
-{
-    background-color: #dda;
-}
-
-a:visited, a:link
-{
-    color: #990;
-    text-decoration: None;
-}
-td a:visited, td a:link
-{
-    display: block;
-}
-a:visited:hover, a:link:hover
-{
-    text-decoration: underline;
-}
-td a:visited:hover, td a:link:hover
-{
-    color:black;
-    background-color:#dda;
-    text-decoration: None;
-    display: block;
-}
-
-body
-{
-    font-family: "Verdana";
-    font-size:11pt;
-    background-color: white;
-}
-.comment
-{
-}
-.comment table
-{
-    background-color: transparent;
-}
-.comment td
-{
-    background-color: transparent;
-}
-.comment pre
-{
-    font-family: "Verdana";
-}
-#header
-{
-    color: black;
-    font-weight: bold;
-    background-image: url(/static/images/half-spiral.png);
-    background-position: right center;
-    background-repeat: no-repeat;
-    background-color: #ff0;
-}
-#header ul.navoption
-{
-    display: block;
-    float: right;
-    margin: 0;
-    padding-right: 30px;
-}
-#header li
-{
-    display: inline;
-    margin:0;
-    padding:0;
-}
-table.insetbox
-{
-  margin-top: 0.5em;
-  margin-bottom: 0.5em;
-}
-.insetbox tr, .insetbox td
-{
-  margin: 0;
-  padding: 0;
-}
-pre.traceback
-{
-  font-family: Verdana, Ariel, Helvetica, sanserif;
-}
-tr.even td
-{
-  background-color: #eee;
-}
-tr.odd td
-{
-  background-color: #ffe;
-}
+table\r
+{\r
+    background-color: black;\r
+}\r
+td\r
+{\r
+    background-color: white;\r
+}\r
+h1\r
+{\r
+    font-family: "Verdana";\r
+    font-weight: bold;\r
+    font-size: 120%;\r
+    margin-bottom:0;\r
+    color: #990;\r
+}\r
+\r
+tr.closed td\r
+{\r
+    background-color: #ccc;\r
+}\r
+tr.closedeven td\r
+{\r
+    background-color: #ccc;\r
+}\r
+tr.closedodd td\r
+{\r
+    background-color: #dda;\r
+}\r
+\r
+a:visited, a:link\r
+{\r
+    color: #990;\r
+    text-decoration: None;\r
+}\r
+td a:visited, td a:link\r
+{\r
+    display: block;\r
+}\r
+a:visited:hover, a:link:hover\r
+{\r
+    text-decoration: underline;\r
+}\r
+td a:visited:hover, td a:link:hover\r
+{\r
+    color:black;\r
+    background-color:#dda;\r
+    text-decoration: None;\r
+    display: block;\r
+}\r
+\r
+body\r
+{\r
+    font-family: "Verdana";\r
+    font-size:11pt;\r
+    background-color: white;\r
+}\r
+.comment\r
+{\r
+}\r
+.comment table\r
+{\r
+    background-color: transparent;\r
+}\r
+.comment td\r
+{\r
+    background-color: transparent;\r
+}\r
+.comment pre\r
+{\r
+    font-family: "Verdana";\r
+}\r
+#header\r
+{\r
+    color: black;\r
+    font-weight: bold;\r
+    background-image: url(/static/images/half-spiral.png);\r
+    background-position: right center;\r
+    background-repeat: no-repeat;\r
+    background-color: #ff0;\r
+}\r
+#header ul.navoption\r
+{\r
+    display: block;\r
+    float: right;\r
+    margin: 0;\r
+    padding-right: 30px;\r
+}\r
+#header li\r
+{\r
+    display: inline;\r
+    margin:0;\r
+    padding:0;\r
+}\r
+table.insetbox\r
+{\r
+  margin-top: 0.5em;\r
+  margin-bottom: 0.5em;\r
+}\r
+.insetbox tr, .insetbox td\r
+{\r
+  margin: 0;\r
+  padding: 0;\r
+}\r
+pre.traceback\r
+{\r
+  font-family: Verdana, Ariel, Helvetica, sanserif;\r
+}\r
+tr.even td\r
+{\r
+  background-color: #eee;\r
+}\r
+tr.odd td\r
+{\r
+  background-color: #ffe;\r
+}\r
diff --git a/Bugs-Everywhere-Web/beweb/static/images/header_inner.png b/Bugs-Everywhere-Web/beweb/static/images/header_inner.png
new file mode 100644 (file)
index 0000000..2b2d87d
Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/header_inner.png differ
diff --git a/Bugs-Everywhere-Web/beweb/static/images/info.png b/Bugs-Everywhere-Web/beweb/static/images/info.png
new file mode 100644 (file)
index 0000000..329c523
Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/info.png differ
diff --git a/Bugs-Everywhere-Web/beweb/static/images/ok.png b/Bugs-Everywhere-Web/beweb/static/images/ok.png
new file mode 100644 (file)
index 0000000..fee6751
Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/ok.png differ
diff --git a/Bugs-Everywhere-Web/beweb/static/images/tg_under_the_hood.png b/Bugs-Everywhere-Web/beweb/static/images/tg_under_the_hood.png
new file mode 100644 (file)
index 0000000..bc9c79c
Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/tg_under_the_hood.png differ
diff --git a/Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png b/Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png
new file mode 100644 (file)
index 0000000..90e84b7
Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png differ
index 2c150db4caddae77d7d353bdff265318997d4a96..e7ad852724680a7df46dd09ef2b451cac64ab868 100644 (file)
@@ -8,7 +8,7 @@
     <meta content="text/html; charset=UTF-8"
         http-equiv="content-type" py:replace="''"/>
     <title>Login</title>
-    <style>
+    <style type="text/css">
         #loginBox
         {
             width: 30%;
@@ -97,7 +97,7 @@
                 </tr>
                 <tr>
                     <td colspan="2" class="buttons">
-                        <input type="submit" value="Login"/>
+                        <input type="submit" name="login" value="Login"/>
                     </td>
                 </tr>
             </table>
index 54f6bad8e0f99e4b598a69c327aebd1d5581ecc5..0772524e621ef88bfd80471fc8af20369dd4936e 100644 (file)
@@ -1,71 +1,71 @@
-<!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:if="False">Your title goes here</title>
-    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>
-    <meta py:replace="item[:]"/>
-    <style>
-        #pageLogin
-        {
-            font-size: 10px;
-            font-family: verdana;
-            text-align: right;
-        }
-    </style>
-</head>
-
-<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
-<div id="header"><div style="float: left">b u g s   e v r y w h e r e</div><ul class="navoption"><li><a href="/about/">About</a></li></ul>&#160;</div> 
-     <div py:if="tg.config('identity.on',False) and not 'logging_in' in locals()"
-        id="pageLogin">
-        <span py:if="tg.identity.anonymous">
-            <a href="/login">Login</a>
-        </span>
-        <span py:if="not tg.identity.anonymous">
-            Welcome ${tg.identity.user.displayName}.
-            <a href="/logout">Logout</a>
-        </span>
-    </div>
-
-    <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
-
-    <div py:replace="item[:]"/>
-
-</body>
-<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}insetbox'" cellspacing="0" cellpadding="0" border="0" class="insetbox">
-<tr height="19"><td background="/static/images/is-tl.png" width="19"/>
-    <td background="/static/images/is-t.png" />
-    <td background="/static/images/is-tr.png" width="11"></td>
-</tr>
-<tr>
-    <td background="/static/images/is-l.png"/>
-    <td py:content="item[:]"> Hello, this is some random text</td>
-    <td background="/static/images/is-r.png"/>
-</tr>
-<tr height="11">
-    <td background="/static/images/is-bl.png"/>
-    <td background="/static/images/is-b.png" />
-    <td background="/static/images/is-br.png"/>
-</tr>
-</table>
-<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}dsbox'" cellspacing="0" cellpadding="0" border="0" class="dsbox">
-<tr height="11"><td background="/static/images/ds-tl.png" width="11"/>
-    <td background="/static/images/ds-t.png" />
-    <td background="/static/images/ds-tr.png" width="19"></td>
-</tr>
-<tr>
-    <td background="/static/images/ds-l.png"/>
-    <td py:content="item[:]"> Hello, this is some random text</td>
-    <td background="/static/images/ds2-r.png"/>
-</tr>
-<tr height="19">
-    <td background="/static/images/ds-bl.png"/>
-    <td background="/static/images/ds2-b.png" />
-    <td background="/static/images/ds-br.png"/>
-</tr>
-</table>
-
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<?python import sitetemplate ?>\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="sitetemplate">\r
+\r
+<head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="item.items()">\r
+    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>\r
+    <title py:if="False">Your title goes here</title>\r
+    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>\r
+    <meta py:replace="item[:]"/>\r
+    <style type="text/css">\r
+        #pageLogin\r
+        {\r
+            font-size: 10px;\r
+            font-family: verdana;\r
+            text-align: right;\r
+        }\r
+    </style>\r
+</head>\r
+\r
+<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">\r
+<div id="header"><div style="float: left">b u g s   e v r y w h e r e</div><ul class="navoption"><li><a href="/about/">About</a></li></ul>&#160;</div> \r
+    <div py:if="tg.config('identity.on',False) and not 'logging_in' in locals()"\r
+        id="pageLogin">\r
+        <span py:if="tg.identity.anonymous">\r
+            <a href="/login">Login</a>\r
+        </span>\r
+        <span py:if="not tg.identity.anonymous">\r
+            Welcome ${tg.identity.user.display_name}.\r
+            <a href="/logout">Logout</a>\r
+        </span>\r
+    </div>\r
+\r
+    <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>\r
+\r
+    <div py:replace="[item.text]+item[:]"/>\r
+\r
+<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}insetbox'" cellspacing="0" cellpadding="0" border="0" class="insetbox">\r
+<tr height="19"><td background="/static/images/is-tl.png" width="19"/>\r
+    <td background="/static/images/is-t.png" />\r
+    <td background="/static/images/is-tr.png" width="11"></td>\r
+</tr>\r
+<tr>\r
+    <td background="/static/images/is-l.png"/>\r
+    <td py:content="item[:]"> Hello, this is some random text</td>\r
+    <td background="/static/images/is-r.png"/>\r
+</tr>\r
+<tr height="11">\r
+    <td background="/static/images/is-bl.png"/>\r
+    <td background="/static/images/is-b.png" />\r
+    <td background="/static/images/is-br.png"/>\r
+</tr>\r
+</table>\r
+<table py:match="item.tag=='{http://www.w3.org/1999/xhtml}dsbox'" cellspacing="0" cellpadding="0" border="0" class="dsbox">\r
+<tr height="11"><td background="/static/images/ds-tl.png" width="11"/>\r
+    <td background="/static/images/ds-t.png" />\r
+    <td background="/static/images/ds-tr.png" width="19"></td>\r
+</tr>\r
+<tr>\r
+    <td background="/static/images/ds-l.png"/>\r
+    <td py:content="item[:]"> Hello, this is some random text</td>\r
+    <td background="/static/images/ds2-r.png"/>\r
+</tr>\r
+<tr height="19">\r
+    <td background="/static/images/ds-bl.png"/>\r
+    <td background="/static/images/ds2-b.png" />\r
+    <td background="/static/images/ds-br.png"/>\r
+</tr>\r
+</table>\r
+</body>\r
+\r
+</html>\r
index 0d3cf3e7c779849e209728294f67f4707edf1e69..08abd21dd140fd4d04dd212123c3d1b468c4d095 100644 (file)
@@ -1,33 +1,50 @@
-<!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>
-    <p>Congratulations, your TurboGears application is running as of <span py:replace="now">now</span>.</p>
-
-    <h2>Are you ready to Gear Up?</h2>
-
-    <p>Take the following steps to dive right in:</p>
-
-    <ol>
-        <li>Edit your project's model.py to create SQLObjects representing the data you're working with</li>
-        <li>Edit your dev.cfg file to point to the database you'll be using</li>
-        <li>Run "<code>tg-admin sql create</code>" to create the tables in the database</li>
-        <li>Edit controllers.py to add the functionality to your webapp</li>
-        <li>Change the master.kid template to have the headers and footers for your application.</li>
-        <li>Change welcome.kid (this template) or create a new one to display your data</li>
-        <li>Repeat steps 4-6 until done.</li>
-        <li><b>Profit!</b></li>
-    </ol>
-
-    <p>If you haven't already, you might check out some of the <a href="http://www.turbogears.org/docs/" >documentation</a>.</p>
-
-    <p>Thanks for using TurboGears! See you on the <a href="http://groups.google.com/group/turbogears" >mailing list</a> and the "turbogears" channel on irc.freenode.org!</p>
-
-</body>
-</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"\r
+    py:extends="'master.kid'">\r
+<head>\r
+<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>\r
+<title>Welcome to TurboGears</title>\r
+</head>\r
+<body>\r
+<div id="header">&nbsp;</div>\r
+<div id="main_content">\r
+  <div id="status_block">Your TurboGears application is now running.</div>\r
+  <!--h1>Take steps to dive right in:</h1-->\r
+  <div id="sidebar">\r
+    <h2>Learn more</h2>\r
+    Learn more about TurboGears and take part in its\r
+    development\r
+    <ul class="links">\r
+      <li><a href="http://www.turbogears.org">Official website</a></li>\r
+      <li><a href="http://docs.turbogears.org">Documentation</a></li>\r
+      <li><a href="http://trac.turbogears.org/turbogears/">Trac\r
+        (bugs/suggestions)</a></li>\r
+      <li><a href="http://groups.google.com/group/turbogears"> Mailing list</a> </li>\r
+    </ul>\r
+  </div>\r
+  <div id="getting_started">\r
+    <ol id="getting_started_steps">\r
+      <li class="getting_started">\r
+        <h3>Model</h3>\r
+        <p> <a href="http://docs.turbogears.org/1.0/GettingStarted/DefineDatabase">Design models</a> in the <span class="code">model.py</span>.<br/>\r
+          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/>\r
+          Use script <span class="code">tg-admin sql create</span> to create the database tables.</p>\r
+      </li>\r
+      <li class="getting_started">\r
+        <h3>View</h3>\r
+        <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/>\r
+        Put all <a href="http://docs.turbogears.org/1.0/StaticFiles">static contents</a> in the <span class="code">/static</span> folder. </p>\r
+      </li>\r
+      <li class="getting_started">\r
+        <h3>Controller</h3>\r
+        <p> Edit <span class="code"> controllers.py</span> and <a href="http://docs.turbogears.org/1.0/GettingStarted/CherryPy">build your\r
+          website structure</a> with the simplicity of Python objects. <br/>\r
+          TurboGears will automatically reload itself when you modify your project. </p>\r
+      </li>\r
+    </ol>\r
+    <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>\r
+  </div>\r
+  <!-- End of getting_started -->\r
+</div>\r
+</body>\r
+</html>\r
index 5346f8bc5a5c39b1ca0f4d931fbad5b6d8e68e10..74c4e8335c09562453c174f74c5ae51b95cca811 100644 (file)
@@ -4,21 +4,20 @@
 # choice for testing, because you can use an in-memory database
 # which is very fast.
 
-from turbogears import testutil
-#from beweb.model import YourDataClass
-#from turbogears.identity.soprovider import TG_User
+from turbogears import testutil, database
+# from beweb.model import YourDataClass, User
 
 # database.set_db_uri("sqlite:///:memory:")
 
-# class testTG_User(testutil.DBTest):
+# class TestUser(testutil.DBTest):
 #     def get_model(self):
-#         return TG_User
+#         return User
 #
 #     def test_creation(self):
 #         "Object creation should set the name"
-#         obj = TG_User(userId = "creosote",
-#                       emailAddress = "spam@python.not",
-#                       displayName = "Mr Creosote",
+#         obj = User(user_name = "creosote",
+#                       email_address = "spam@python.not",
+#                       display_name = "Mr Creosote",
 #                       password = "Wafer-thin Mint")
-#         assert obj.displayName == "Mr Creosote"
+#         assert obj.display_name == "Mr Creosote"
 
index c8e165860eb35c9f46e255956cda689b8de29464..cd7c7d72bff381249a22b01013c9c8c45adf2d9e 100644 (file)
@@ -2,7 +2,7 @@
 # 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 
-# yourpackage/config/app.cfg
+# beweb/config/app.cfg
 
 # DATABASE
 
 # sqlobject.dburi="mysql://username:password@hostname:port/databasename"
 sqlobject.dburi="sqlite://%(package_dir)s/database.sqlite"
 
+# 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"
-
+# sqlobject.dburi="sqlite:///drive_letter:/path/to/file"
 
 # SERVER
 
@@ -31,7 +35,33 @@ sqlobject.dburi="sqlite://%(package_dir)s/database.sqlite"
 server.environment="development"
 autoreload.package="beweb"
 
+# session_filter.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
+identity.on = True
+visit.on = 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 beweb/config/log.cfg
+[logging]
+
+[[loggers]]
+[[[beweb]]]
+level='DEBUG'
+qualname='beweb'
+handlers=['debug_out']
+
+[[[allinfo]]]
+level='INFO'
+handlers=['debug_out']
 
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
diff --git a/Bugs-Everywhere-Web/sample-prod.cfg b/Bugs-Everywhere-Web/sample-prod.cfg
new file mode 100644 (file)
index 0000000..d1052f8
--- /dev/null
@@ -0,0 +1,71 @@
+[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 
+# beweb/config/app.cfg
+
+# 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=""
+
+# session_filter.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 = 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 beweb/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]]
+[[[beweb]]]
+level='ERROR'
+qualname='beweb'
+handlers=['error_out']
+
+[[[access]]]
+level='INFO'
+qualname='turbogears.access'
+handlers=['access_out']
+propagate=0
index 29f1d6f9393d78ffc219329506e312973f3a697f..8ba3da2db205a44d0a6d9b816f8a1aff724fb11b 100644 (file)
@@ -16,7 +16,9 @@ setup(
     #download_url=download_url,
     #license=license,
     
-    install_requires = ["TurboGears >= 0.9a4"],
+    install_requires = [
+        "TurboGears >= 1.0b1",
+    ],
     scripts = ["start-beweb.py"],
     zip_safe=False,
     packages=find_packages(),
index 6eba52741dfc363151bb3ba451a23bd0fbc52892..39100e7693389d1348c5deb6f4dd4f1f822bd0ef 100755 (executable)
@@ -15,15 +15,14 @@ import sys
 # probably installed
 if len(sys.argv) > 1:
     turbogears.update_config(configfile=sys.argv[1], 
-        modulename="beweb.config.app")
+        modulename="beweb.config")
 elif exists(join(dirname(__file__), "setup.py")):
     turbogears.update_config(configfile="dev.cfg",
-        modulename="beweb.config.app")
+        modulename="beweb.config")
 else:
     turbogears.update_config(configfile="prod.cfg",
-        modulename="beweb.config.app")
+        modulename="beweb.config")
 
 from beweb.controllers import Root
 
-cherrypy.root = Root()
-cherrypy.server.start()
+turbogears.start_server(Root())