From ea15510609d1516000daa8a685731df5d549bfba Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Tue, 5 Dec 2006 16:08:03 -0500 Subject: Mostly upgrade to turbogears 1.0b1 --- .../Bugs_Everywhere_Web.egg-info/SOURCES.txt | 44 ++++ .../dependency_links.txt | 1 + .../Bugs_Everywhere_Web.egg-info/not-zip-safe | 1 + .../Bugs_Everywhere_Web.egg-info/requires.txt | 2 +- Bugs-Everywhere-Web/beweb/config/app.cfg | 42 ++++ Bugs-Everywhere-Web/beweb/config/log.cfg | 29 +++ Bugs-Everywhere-Web/beweb/controllers.py | 12 +- Bugs-Everywhere-Web/beweb/json.py | 13 ++ Bugs-Everywhere-Web/beweb/model.py | 105 +++++++++- Bugs-Everywhere-Web/beweb/release.py | 1 + Bugs-Everywhere-Web/beweb/static/css/style.css | 232 ++++++++++----------- .../beweb/static/images/header_inner.png | Bin 0 -> 37537 bytes Bugs-Everywhere-Web/beweb/static/images/info.png | Bin 0 -> 2889 bytes Bugs-Everywhere-Web/beweb/static/images/ok.png | Bin 0 -> 25753 bytes .../beweb/static/images/tg_under_the_hood.png | Bin 0 -> 4010 bytes .../beweb/static/images/under_the_hood_blue.png | Bin 0 -> 2667 bytes Bugs-Everywhere-Web/beweb/templates/login.kid | 4 +- Bugs-Everywhere-Web/beweb/templates/master.kid | 142 ++++++------- Bugs-Everywhere-Web/beweb/templates/welcome.kid | 83 +++++--- Bugs-Everywhere-Web/beweb/tests/test_model.py | 17 +- Bugs-Everywhere-Web/dev.cfg | 36 +++- Bugs-Everywhere-Web/sample-prod.cfg | 71 +++++++ Bugs-Everywhere-Web/setup.py | 4 +- Bugs-Everywhere-Web/start-beweb.py | 9 +- 24 files changed, 599 insertions(+), 249 deletions(-) create mode 100644 Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/SOURCES.txt create mode 100644 Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/dependency_links.txt create mode 100644 Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/not-zip-safe create mode 100644 Bugs-Everywhere-Web/beweb/config/app.cfg create mode 100644 Bugs-Everywhere-Web/beweb/config/log.cfg create mode 100644 Bugs-Everywhere-Web/beweb/json.py create mode 100644 Bugs-Everywhere-Web/beweb/static/images/header_inner.png create mode 100644 Bugs-Everywhere-Web/beweb/static/images/info.png create mode 100644 Bugs-Everywhere-Web/beweb/static/images/ok.png create mode 100644 Bugs-Everywhere-Web/beweb/static/images/tg_under_the_hood.png create mode 100644 Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png create mode 100644 Bugs-Everywhere-Web/sample-prod.cfg (limited to 'Bugs-Everywhere-Web') 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 index 0000000..ab62ee4 --- /dev/null +++ b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/SOURCES.txt @@ -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 index 0000000..8b13789 --- /dev/null +++ b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/dependency_links.txt @@ -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 index 0000000..8b13789 --- /dev/null +++ b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/not-zip-safe @@ -0,0 +1 @@ + diff --git a/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/requires.txt b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/requires.txt index b4e1d25..5fd6f71 100644 --- a/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/requires.txt +++ b/Bugs-Everywhere-Web/Bugs_Everywhere_Web.egg-info/requires.txt @@ -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 index 0000000..d37cf67 --- /dev/null +++ b/Bugs-Everywhere-Web/beweb/config/app.cfg @@ -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="" + +# 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 index 0000000..ce776f8 --- /dev/null +++ b/Bugs-Everywhere-Web/beweb/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/Bugs-Everywhere-Web/beweb/controllers.py b/Bugs-Everywhere-Web/beweb/controllers.py index 5f0046e..358e74a 100644 --- a/Bugs-Everywhere-Web/beweb/controllers.py +++ b/Bugs-Everywhere-Web/beweb/controllers.py @@ -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 index 0000000..6e100c3 --- /dev/null +++ b/Bugs-Everywhere-Web/beweb/json.py @@ -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 + diff --git a/Bugs-Everywhere-Web/beweb/model.py b/Bugs-Everywhere-Web/beweb/model.py index 6a603bb..5537dae 100644 --- a/Bugs-Everywhere-Web/beweb/model.py +++ b/Bugs-Everywhere-Web/beweb/model.py @@ -1,15 +1,108 @@ +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 diff --git a/Bugs-Everywhere-Web/beweb/release.py b/Bugs-Everywhere-Web/beweb/release.py index 0232912..9d64bf7 100644 --- a/Bugs-Everywhere-Web/beweb/release.py +++ b/Bugs-Everywhere-Web/beweb/release.py @@ -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" diff --git a/Bugs-Everywhere-Web/beweb/static/css/style.css b/Bugs-Everywhere-Web/beweb/static/css/style.css index ada46f3..6fe197f 100644 --- a/Bugs-Everywhere-Web/beweb/static/css/style.css +++ b/Bugs-Everywhere-Web/beweb/static/css/style.css @@ -1,116 +1,116 @@ -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 +{ + 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; +} 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 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 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 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 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 index 0000000..90e84b7 Binary files /dev/null and b/Bugs-Everywhere-Web/beweb/static/images/under_the_hood_blue.png differ diff --git a/Bugs-Everywhere-Web/beweb/templates/login.kid b/Bugs-Everywhere-Web/beweb/templates/login.kid index 2c150db..e7ad852 100644 --- a/Bugs-Everywhere-Web/beweb/templates/login.kid +++ b/Bugs-Everywhere-Web/beweb/templates/login.kid @@ -8,7 +8,7 @@ Login - - - - - -
- - Login - - - Welcome ${tg.identity.user.displayName}. - Logout - -
- -
- -
- - - - - - - - - - -
- -
- Hello, this is some random text -
- - -
- - - - - - - - -
- -
- Hello, this is some random text -
- - -
- - + + + + + + + Your title goes here + + + + + + + +
+ + Login + + + Welcome ${tg.identity.user.display_name}. + Logout + +
+ +
+ +
+ + + + + + + + + +
+ +
+ Hello, this is some random text +
+ + +
+ + + + + + + + +
+ +
+ Hello, this is some random text +
+ + +
+ + + diff --git a/Bugs-Everywhere-Web/beweb/templates/welcome.kid b/Bugs-Everywhere-Web/beweb/templates/welcome.kid index 0d3cf3e..08abd21 100644 --- a/Bugs-Everywhere-Web/beweb/templates/welcome.kid +++ b/Bugs-Everywhere-Web/beweb/templates/welcome.kid @@ -1,33 +1,50 @@ - - - - - - Welcome to TurboGears - - - -

Congratulations, your TurboGears application is running as of now.

- -

Are you ready to Gear Up?

- -

Take the following steps to dive right in:

- -
    -
  1. Edit your project's model.py to create SQLObjects representing the data you're working with
  2. -
  3. Edit your dev.cfg file to point to the database you'll be using
  4. -
  5. Run "tg-admin sql create" to create the tables in the database
  6. -
  7. Edit controllers.py to add the functionality to your webapp
  8. -
  9. Change the master.kid template to have the headers and footers for your application.
  10. -
  11. Change welcome.kid (this template) or create a new one to display your data
  12. -
  13. Repeat steps 4-6 until done.
  14. -
  15. Profit!
  16. -
- -

If you haven't already, you might check out some of the documentation.

- -

Thanks for using TurboGears! See you on the mailing list and the "turbogears" channel on irc.freenode.org!

- - - + + + + +Welcome to TurboGears + + + +
+
Your TurboGears application is now running.
+ + +
+
    +
  1. +

    Model

    +

    Design models in the model.py.
    + Edit dev.cfg to use a different backend, or start with a pre-configured SQLite database.
    + Use script tg-admin sql create to create the database tables.

    +
  2. +
  3. +

    View

    +

    Edit html-like templates in the /templates folder;
    + Put all static contents in the /static folder.

    +
  4. +
  5. +

    Controller

    +

    Edit controllers.py and build your + website structure with the simplicity of Python objects.
    + TurboGears will automatically reload itself when you modify your project.

    +
  6. +
+
If you create something cool, please let people know, and consider contributing something back to the community.
+
+ +
+ + diff --git a/Bugs-Everywhere-Web/beweb/tests/test_model.py b/Bugs-Everywhere-Web/beweb/tests/test_model.py index 5346f8b..74c4e83 100644 --- a/Bugs-Everywhere-Web/beweb/tests/test_model.py +++ b/Bugs-Everywhere-Web/beweb/tests/test_model.py @@ -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" diff --git a/Bugs-Everywhere-Web/dev.cfg b/Bugs-Everywhere-Web/dev.cfg index c8e1658..cd7c7d7 100644 --- a/Bugs-Everywhere-Web/dev.cfg +++ b/Bugs-Everywhere-Web/dev.cfg @@ -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 @@ -11,14 +11,18 @@ # 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 index 0000000..d1052f8 --- /dev/null +++ b/Bugs-Everywhere-Web/sample-prod.cfg @@ -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 diff --git a/Bugs-Everywhere-Web/setup.py b/Bugs-Everywhere-Web/setup.py index 29f1d6f..8ba3da2 100644 --- a/Bugs-Everywhere-Web/setup.py +++ b/Bugs-Everywhere-Web/setup.py @@ -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(), diff --git a/Bugs-Everywhere-Web/start-beweb.py b/Bugs-Everywhere-Web/start-beweb.py index 6eba527..39100e7 100755 --- a/Bugs-Everywhere-Web/start-beweb.py +++ b/Bugs-Everywhere-Web/start-beweb.py @@ -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()) -- cgit