changeset 2779:45c65345e909

migrate to new layout
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Mon, 18 Oct 2004 08:57:36 +0000
parents abea6536bd6f
children d7244190b5aa
files templates/minimal/__init__.py templates/minimal/config.py templates/minimal/dbinit.py templates/minimal/detectors/__init__.py templates/minimal/initial_data.py templates/minimal/interfaces.py templates/minimal/schema.py
diffstat 7 files changed, 85 insertions(+), 366 deletions(-) [+]
line wrap: on
line diff
--- a/templates/minimal/__init__.py	Mon Oct 18 07:57:32 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-# $Id: __init__.py,v 1.1 2003-04-17 03:27:27 richard Exp $
-
-import config
-from dbinit import open, init
-from interfaces import Client, MailGW
-
-# vim: set filetype=python ts=4 sw=4 et si
--- a/templates/minimal/config.py	Mon Oct 18 07:57:32 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-# $Id: config.py,v 1.8 2004-07-20 00:15:23 richard Exp $
-
-import os
-
-# roundup home is this package's directory
-TRACKER_HOME=os.path.split(__file__)[0]
-
-# The SMTP mail host that roundup will use to send mail
-MAILHOST = 'localhost'
-
-# If your SMTP mail host requires a username and password for access, then
-# specify them here.
-# eg. MAILUSER = ('username', 'password')
-MAILUSER = ()
-
-# If your SMTP mail host provides or requires TLS (Transport Layer
-# Security) then set MAILHOST_TLS = 'yes'
-# Optionallly, you may also set MAILHOST_TLS_KEYFILE to the name of a PEM
-# formatted file that contains your private key, and MAILHOST_TLS_CERTFILE
-# to the name of a PEM formatted certificate chain file.
-MAILHOST_TLS = 'no'
-MAILHOST_TLS_KEYFILE = ''
-MAILHOST_TLS_CERTFILE = ''
-
-# The domain name used for email addresses.
-MAIL_DOMAIN = 'your.tracker.email.domain.example'
-
-# This is the directory that the database is going to be stored in
-DATABASE = os.path.join(TRACKER_HOME, 'db')
-
-# This is the directory that the HTML templates reside in
-TEMPLATES = os.path.join(TRACKER_HOME, 'html')
-
-# Optional: the directory that static files are served from (files with the
-# URL /@@file/<filename>). If this is not defined, then static files are
-# served from the TEMPLATES directory.
-# STATIC_FILES = os.path.join(TRACKER_HOME, 'files')
-
-# A descriptive name for your roundup instance
-TRACKER_NAME = 'Roundup issue tracker'
-
-# The email address that mail to roundup should go to
-TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN
-
-# The web address that the tracker is viewable at. This will be included in
-# information sent to users of the tracker. The URL MUST include the cgi-bin
-# part or anything else that is required to get to the home page of the
-# tracker. You MUST include a trailing '/' in the URL.
-TRACKER_WEB = 'http://tracker.example/cgi-bin/roundup.cgi/bugs/'
-
-# The email address that roundup will complain to if it runs into trouble
-ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN
-
-# These variables define where to log Roundup's internal messages to.
-# You have two choices - either using the standard Python logging module
-# or a minimal logging facility built into Roundup. The former is activated
-# when you provide a LOGGING_CONFIG variable below which contains the
-# configuration of the logging module. The latter is activated when you
-# provide the LOGGING_FILENAME and optionally LOGGING_LEVEL variables. If
-# none of these variables are defined then only errors will be logged, and
-# they will go to stderr.
-# LOGGGING_CONFIG = os.path.join(TRACKER_HOME, 'logging.ini')
-# or,
-# LOGGING_FILENAME = '/path/to/log file'
-# LOGGING_LEVEL = 'INFO'   # one of 'DEBUG', 'INFO', 'WARNING', 'ERROR'
-
-# The 'dispatcher' is a role that can get notified of new items to the database.
-DISPATCHER_EMAIL = ADMIN_EMAIL
-
-# Additional text to include in the "name" part of the From: address used
-# in nosy messages. If the sending user is "Foo Bar", the From: line is
-# usually: "Foo Bar" <issue_tracker@tracker.example>
-# the EMAIL_FROM_TAG goes inside the "Foo Bar" quotes like so:
-#    "Foo Bar EMAIL_FROM_TAG" <issue_tracker@tracker.example>
-EMAIL_FROM_TAG = ""
-
-# 
-# SECURITY DEFINITIONS
-#
-# define the Roles that a user gets when they register with the tracker
-# these are a comma-separated string of role names (e.g. 'Admin,User')
-NEW_WEB_USER_ROLES = 'User'
-NEW_EMAIL_USER_ROLES = 'User'
-
-# Send error messages to the dispatcher, user, or both?
-# If 'dispatcher', error message notifications will only be sent to the dispatcher.
-# If 'user',       error message notifications will only be sent to the user.
-# If 'both',       error message notifications will be sent to both individuals.
-ERROR_MESSAGES_TO = 'user'
-
-# Send nosy messages to the author of the message
-MESSAGES_TO_AUTHOR = 'no'           # either 'yes' or 'no'
-
-# Does the author of a message get placed on the nosy list automatically?
-# If 'new' is used, then the author will only be added when a message
-# creates a new issue. If 'yes', then the author will be added on followups
-# too. If 'no', they're never added to the nosy.
-ADD_AUTHOR_TO_NOSY = 'new'          # one of 'yes', 'no', 'new'
-
-# Do the recipients (To:, Cc:) of a message get placed on the nosy list?
-# If 'new' is used, then the recipients will only be added when a message
-# creates a new issue. If 'yes', then the recipients will be added on followups
-# too. If 'no', they're never added to the nosy.
-ADD_RECIPIENTS_TO_NOSY = 'new'      # either 'yes', 'no', 'new'
-
-# Where to place the email signature
-EMAIL_SIGNATURE_POSITION = 'bottom' # one of 'top', 'bottom', 'none'
-
-# Keep email citations when accepting messages. Setting this to "no" strips
-# out "quoted" text from the message. Signatures are also stripped.
-EMAIL_KEEP_QUOTED_TEXT = 'yes'      # either 'yes' or 'no'
-
-# Preserve the email body as is - that is, keep the citations _and_
-# signatures.
-EMAIL_LEAVE_BODY_UNCHANGED = 'no'   # either 'yes' or 'no'
-
-# Default class to use in the mailgw if one isn't supplied in email
-# subjects. To disable, comment out the variable below or leave it blank.
-# Examples:
-MAIL_DEFAULT_CLASS = 'issue'   # use "issue" class by default
-#MAIL_DEFAULT_CLASS = ''        # disable (or just comment the var out)
-
-# HTML version to generate. The templates are html4 by default. If you
-# wish to make them xhtml, then you'll need to change this var to 'xhtml'
-# too so all auto-generated HTML is compliant.
-HTML_VERSION = 'html4'         # either 'html4' or 'xhtml'
-
-# Character set to encode email headers with. We use utf-8 by default, as
-# it's the most flexible. Some mail readers (eg. Eudora) can't cope with
-# that, so you might need to specify a more limited character set (eg.
-# 'iso-8859-1'.
-EMAIL_CHARSET = 'utf-8'
-#EMAIL_CHARSET = 'iso-8859-1'   # use this instead for Eudora users
-
-# You may specify a different default timezone, for use when users do not
-# choose their own in their settings.
-DEFAULT_TIMEZONE = 0            # specify as numeric hour offest
-
-# vim: set filetype=python ts=4 sw=4 et si
--- a/templates/minimal/dbinit.py	Mon Oct 18 07:57:32 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-#
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-# $Id: dbinit.py,v 1.2 2004-03-12 05:36:26 richard Exp $
-
-import os
-
-import config
-from select_db import Database, Class, FileClass, IssueClass
-
-def open(name=None):
-    ''' as from the roundupdb method openDB 
-    ''' 
-    from roundup.hyperdb import String, Password, Date, Link, Multilink
-    from roundup.hyperdb import Interval, Boolean, Number
-
-    # open the database
-    db = Database(config, name)
-
-    #
-    # Now initialise the schema. Must do this each time the database is
-    # opened.
-    #
-
-    # The "Minimal" template gets only one class, the required "user"
-    # class. That's it. And even that has the bare minimum of properties.
-
-    # Note: roles is a comma-separated string of Role names
-    user = Class(db, "user", username=String(), password=Password(),
-        address=String(), alternate_addresses=String(), roles=String())
-    user.setkey("username")
-
-    # add any additional database schema configuration here
-
-    #
-    # SECURITY SETTINGS
-    #
-    # and give the regular users access to the web and email interface
-    p = db.security.getPermission('Web Access')
-    db.security.addPermissionToRole('User', p)
-    p = db.security.getPermission('Email Access')
-    db.security.addPermissionToRole('User', p)
-
-    # May users view other user information? Comment these lines out
-    # if you don't want them to
-    p = db.security.getPermission('View', 'user')
-    db.security.addPermissionToRole('User', p)
-
-    # Assign the appropriate permissions to the anonymous user's Anonymous
-    # Role. Choices here are:
-    # - Allow anonymous users to register through the web
-    p = db.security.getPermission('Web Registration')
-    db.security.addPermissionToRole('Anonymous', p)
-    # - Allow anonymous (new) users to register through the email gateway
-    p = db.security.getPermission('Email Registration')
-    db.security.addPermissionToRole('Anonymous', p)
-
-    import detectors
-    detectors.init(db)
-
-    # schema is set up - run any post-initialisation
-    db.post_init()
-    return db
- 
-def init(adminpw): 
-    ''' as from the roundupdb method initDB 
- 
-    Open the new database, and add new nodes - used for initialisation. You
-    can edit this before running the "roundup-admin initialise" command to
-    change the initial database entries.
-    ''' 
-    dbdir = os.path.join(config.DATABASE, 'files')
-    if not os.path.isdir(dbdir):
-        os.makedirs(dbdir)
-
-    db = open("admin")
-    db.clear()
-
-    # create the two default users
-    user = db.getclass('user')
-    user.create(username="admin", password=adminpw,
-        address=config.ADMIN_EMAIL, roles='Admin')
-    user.create(username="anonymous", roles='Anonymous')
-
-    # add any additional database create steps here - but only if you
-    # haven't initialised the database with the admin "initialise" command
-
-    db.commit()
-
-# vim: set filetype=python ts=4 sw=4 et si
-
--- a/templates/minimal/detectors/__init__.py	Mon Oct 18 07:57:32 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-#$Id: __init__.py,v 1.4 2003-10-07 06:18:45 richard Exp $
-
-import sys, os, imp
-
-def init(db):
-    ''' execute the init functions of all the modules in this directory
-    '''
-    this_dir = os.path.split(__file__)[0]
-    for filename in os.listdir(this_dir):
-        name, ext = os.path.splitext(filename)
-        if name == '__init__':
-            continue
-        if ext == '.py':
-            path = os.path.abspath(os.path.join(this_dir, filename))
-            fp = open(path)
-            try:
-                module = imp.load_module(name, fp, path,
-                    ('.py', 'r', imp.PY_SOURCE))
-            finally:
-                fp.close()
-            module.init(db)
-
-# vim: set filetype=python ts=4 sw=4 et si
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/minimal/initial_data.py	Mon Oct 18 08:57:36 2004 +0000
@@ -0,0 +1,14 @@
+#
+# TRACKER DATABASE INITIALIZATION
+#
+
+# create the two default users
+user = db.getclass('user')
+user.create(username="admin", password=adminpw,
+    address=admin_email, roles='Admin')
+user.create(username="anonymous", roles='Anonymous')
+
+# add any additional database create steps here - but only if you
+# haven't initialised the database with the admin "initialise" command
+
+# vim: set et sts=4 sw=4 :
--- a/templates/minimal/interfaces.py	Mon Oct 18 07:57:32 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#
-# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
-# This module is free software, and you may redistribute it and/or modify
-# under the same terms as Python, so long as this copyright message and
-# disclaimer are retained in their original form.
-#
-# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
-# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE.  THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
-# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
-# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-# 
-# $Id: interfaces.py,v 1.1 2003-04-17 03:27:27 richard Exp $
-
-from roundup import mailgw 
-from roundup.cgi import client
-
-class Client(client.Client): 
-    ''' derives basic CGI implementation from the standard module, 
-        with any specific extensions 
-    ''' 
-    pass
-
-class TemplatingUtils:
-    ''' Methods implemented on this class will be available to HTML templates
-        through the 'utils' variable.
-    '''
-    pass
-
-class MailGW(mailgw.MailGW): 
-    ''' derives basic mail gateway implementation from the standard module, 
-        with any specific extensions 
-    ''' 
-    pass
-
-# vim: set filetype=python ts=4 sw=4 et si
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/minimal/schema.py	Mon Oct 18 08:57:36 2004 +0000
@@ -0,0 +1,71 @@
+#
+# TRACKER SCHEMA
+#
+
+# Class automatically gets these properties:
+#   creation = Date()
+#   activity = Date()
+#   creator = Link('user')
+#   actor = Link('user')
+
+# The "Minimal" template gets only one class, the required "user"
+# class. That's it. And even that has the bare minimum of properties.
+
+# Note: roles is a comma-separated string of Role names
+user = Class(db, "user", username=String(), password=Password(),
+    address=String(), alternate_addresses=String(), roles=String())
+user.setkey("username")
+#
+# TRACKER SECURITY SETTINGS
+#
+# See the configuration and customisation document for information
+# about security setup.
+
+#
+# REGULAR USERS
+#
+# Give the regular users access to the web and email interface
+p = db.security.getPermission('Web Access')
+db.security.addPermissionToRole('User', p)
+p = db.security.getPermission('Email Access')
+db.security.addPermissionToRole('User', p)
+
+# May users view other user information?
+# Comment these lines out if you don't want them to
+p = db.security.getPermission('View', 'user')
+db.security.addPermissionToRole('User', p)
+
+# Users should be able to edit their own details.
+# Note that this permission is limited to only the situation
+# where the Viewed or Edited item is their own.
+def own_record(db, userid, itemid):
+    '''Determine whether the userid matches the item being accessed.'''
+    return userid == itemid
+p = db.security.addPermission(name='View', klass='user', check=own_record,
+    description="User is allowed to view their own user details")
+p = db.security.addPermission(name='Edit', klass='user', check=own_record,
+    description="User is allowed to edit their own user details")
+db.security.addPermissionToRole('User', p)
+
+#
+# ANONYMOUS USER PERMISSIONS
+#
+# Let anonymous users access the web interface. Note that almost all
+# trackers will need this Permission. The only situation where it's not
+# required is in a tracker that uses an HTTP Basic Authenticated front-end.
+p = db.security.getPermission('Web Access')
+db.security.addPermissionToRole('Anonymous', p)
+
+# Let anonymous users access the email interface (note that this implies
+# that they will be registered automatically, hence they will need the
+# "Create" user Permission below)
+p = db.security.getPermission('Email Access')
+db.security.addPermissionToRole('Anonymous', p)
+
+# Assign the appropriate permissions to the anonymous user's
+# Anonymous Role. Choices here are:
+# - Allow anonymous users to register
+p = db.security.getPermission('Create', 'user')
+db.security.addPermissionToRole('Anonymous', p)
+
+# vim: set et sts=4 sw=4 :

Roundup Issue Tracker: http://roundup-tracker.org/