From: richard Date: Tue, 9 Oct 2001 07:38:58 +0000 (+0000) Subject: Pushed the base code for the extended schema CGI interface back into the X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f108147730542628bfd046b547b77228cd11c37f;p=roundup.git Pushed the base code for the extended schema CGI interface back into the code cgi_client module so that future updates will be less painful. Also removed a debugging print statement from cgi_client. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@281 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index e8e6c0b..d4cdaf5 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.29 2001-10-09 07:25:59 richard Exp $ +# $Id: cgi_client.py,v 1.30 2001-10-09 07:38:58 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes import base64, Cookie, time @@ -30,7 +30,6 @@ class NotFound(ValueError): class Client: ''' - A note about login ------------------ @@ -504,7 +503,6 @@ class Client: # and that the password is correct pw = self.db.user.get(uid, 'password') - print password, pw, `pw` if password != self.db.user.get(uid, 'password'): self.make_user_anonymous() return self.login(message='Incorrect password') @@ -649,6 +647,79 @@ class Client: def __del__(self): self.db.close() + +class ExtendedClient(Client): + '''Includes pages and page heading information that relate to the + extended schema. + ''' + showsupport = Client.shownode + showtimelog = Client.shownode + newsupport = Client.newnode + newtimelog = Client.newnode + + default_index_sort = ['-activity'] + default_index_group = ['priority'] + default_index_filter = [] + default_index_columns = ['activity','status','title','assignedto'] + default_index_filterspec = {'status': ['1', '2', '3', '4', '5', '6', '7']} + + def pagehead(self, title, message=None): + url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') + machine = self.env['SERVER_NAME'] + port = self.env['SERVER_PORT'] + if port != '80': machine = machine + ':' + port + base = urlparse.urlunparse(('http', machine, url, None, None, None)) + if message is not None: + message = '
%s
'%message + else: + message = '' + style = open(os.path.join(self.TEMPLATES, 'style.css')).read() + user_name = self.user or '' + if self.user == 'admin': + admin_links = ' | Class List' + else: + admin_links = '' + if self.user not in (None, 'anonymous'): + userid = self.db.user.lookup(self.user) + user_info = ''' +My Issues | +My Support | +My Details | Logout +'''%(userid, userid, userid) + else: + user_info = 'Login' + if self.user is not None: + add_links = ''' +| Add +Issue, +Support, +User +''' + else: + add_links = '' + self.write(''' +%s + + + +%s + + + + + + +
%s%s
All +Issues, +Support +| Unassigned +Issues, +Support +%s +%s%s
+'''%(title, style, message, title, user_name, add_links, admin_links, + user_info)) + def parsePropsFromForm(cl, form, nodeid=0): '''Pull properties for the given class out of the form. ''' @@ -706,6 +777,10 @@ def parsePropsFromForm(cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.29 2001/10/09 07:25:59 richard +# Added the Password property type. See "pydoc roundup.password" for +# implementation details. Have updated some of the documentation too. +# # Revision 1.28 2001/10/08 00:34:31 richard # Change message was stuffing up for multilinks with no key property. # diff --git a/roundup/templates/classic/interfaces.py b/roundup/templates/classic/interfaces.py index c8b6f53..6046b8a 100644 --- a/roundup/templates/classic/interfaces.py +++ b/roundup/templates/classic/interfaces.py @@ -15,15 +15,13 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: interfaces.py,v 1.6 2001-08-07 00:24:43 richard Exp $ - -import urlparse, os +# $Id: interfaces.py,v 1.7 2001-10-09 07:38:58 richard Exp $ import instance_config from roundup import cgi_client, mailgw class Client(cgi_client.Client): - ''' derives basic mail gateway implementation from the standard module, + ''' derives basic CGI implementation from the standard module, with any specific extensions ''' TEMPLATES = instance_config.TEMPLATES @@ -38,6 +36,9 @@ class MailGW(mailgw.MailGW): # # $Log: not supported by cvs2svn $ +# Revision 1.6 2001/08/07 00:24:43 richard +# stupid typo +# # Revision 1.5 2001/08/07 00:15:51 richard # Added the copyright/license notice to (nearly) all files at request of # Bizar Software. diff --git a/roundup/templates/extended/interfaces.py b/roundup/templates/extended/interfaces.py index 77fd54f..14eba7a 100644 --- a/roundup/templates/extended/interfaces.py +++ b/roundup/templates/extended/interfaces.py @@ -15,83 +15,16 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: interfaces.py,v 1.10 2001-10-05 02:23:24 richard Exp $ +# $Id: interfaces.py,v 1.11 2001-10-09 07:38:58 richard Exp $ -import instance_config, urlparse, os +import instance_config from roundup import cgi_client, mailgw -class Client(cgi_client.Client): - ''' derives basic mail gateway implementation from the standard module, +class Client(cgi_client.ExtendedClient): + ''' derives basic CGI implementation from the standard module, with any specific extensions ''' TEMPLATES = instance_config.TEMPLATES - showsupport = cgi_client.Client.shownode - showtimelog = cgi_client.Client.shownode - newsupport = cgi_client.Client.newnode - newtimelog = cgi_client.Client.newnode - - default_index_sort = ['-activity'] - default_index_group = ['priority'] - default_index_filter = [] - default_index_columns = ['activity','status','title','assignedto'] - default_index_filterspec = {'status': ['1', '2', '3', '4', '5', '6', '7']} - - def pagehead(self, title, message=None): - url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/') - machine = self.env['SERVER_NAME'] - port = self.env['SERVER_PORT'] - if port != '80': machine = machine + ':' + port - base = urlparse.urlunparse(('http', machine, url, None, None, None)) - if message is not None: - message = '
%s
'%message - else: - message = '' - style = open(os.path.join(self.TEMPLATES, 'style.css')).read() - user_name = self.user or '' - if self.user == 'admin': - admin_links = ' | Class List' - else: - admin_links = '' - if self.user not in (None, 'anonymous'): - userid = self.db.user.lookup(self.user) - user_info = ''' -My Issues | -My Support | -My Details | Logout -'''%(userid, userid, userid) - else: - user_info = 'Login' - if self.user is not None: - add_links = ''' -| Add -Issue, -Support, -User -''' - else: - add_links = '' - self.write(''' -%s - - - -%s - - - - - - -
%s%s
All -Issues, -Support -| Unassigned -Issues, -Support -%s -%s%s
-'''%(title, style, message, title, user_name, add_links, admin_links, - user_info)) class MailGW(mailgw.MailGW): ''' derives basic mail gateway implementation from the standard module, @@ -103,6 +36,26 @@ class MailGW(mailgw.MailGW): # # $Log: not supported by cvs2svn $ +# Revision 1.10 2001/10/05 02:23:24 richard +# . roundup-admin create now prompts for property info if none is supplied +# on the command-line. +# . hyperdb Class getprops() method may now return only the mutable +# properties. +# . Login now uses cookies, which makes it a whole lot more flexible. We can +# now support anonymous user access (read-only, unless there's an +# "anonymous" user, in which case write access is permitted). Login +# handling has been moved into cgi_client.Client.main() +# . The "extended" schema is now the default in roundup init. +# . The schemas have had their page headings modified to cope with the new +# login handling. Existing installations should copy the interfaces.py +# file from the roundup lib directory to their instance home. +# . Incorrectly had a Bizar Software copyright on the cgitb.py module from +# Ping - has been removed. +# . Fixed a whole bunch of places in the CGI interface where we should have +# been returning Not Found instead of throwing an exception. +# . Fixed a deviation from the spec: trying to modify the 'id' property of +# an item now throws an exception. +# # Revision 1.9 2001/08/07 00:24:43 richard # stupid typo #