X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=roundup%2Fcgi%2Fclient.py;h=11a22172e9c1f69437c139afa66525d78d6986a1;hb=5bce0be3879628d6bfa0b6a0c844703c9de96b05;hp=f85d695fd09de7391a89eeac621d67cb98024d82;hpb=3bceec4a1de15fb4048c0eaac567de9b50b5f5c6;p=roundup.git diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index f85d695..11a2217 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -1,111 +1,255 @@ -# $Id: client.py,v 1.116 2003-05-09 03:32:41 richard Exp $ - -__doc__ = """ -WWW request handler (also used in the stand-alone server). +"""WWW request handler (also used in the stand-alone server). """ - -import os, os.path, cgi, StringIO, urlparse, re, traceback, mimetypes, urllib -import binascii, Cookie, time, random, MimeWriter, smtplib, socket, quopri -import stat, rfc822, string - -from roundup import roundupdb, date, hyperdb, password, token -from roundup.i18n import _ -from roundup.cgi.templating import Templates, HTMLRequest, NoTemplate -from roundup.cgi import cgitb -from roundup.cgi.PageTemplates import PageTemplate -from roundup.rfc2822 import encode_header -from roundup.mailgw import uidFromAddress, openSMTPConnection - -class HTTPException(Exception): - pass -class Unauthorised(HTTPException): - pass -class NotFound(HTTPException): - pass -class Redirect(HTTPException): - pass -class NotModified(HTTPException): - pass - -# set to indicate to roundup not to actually _send_ email -# this var must contain a file to write the mail to -SENDMAILDEBUG = os.environ.get('SENDMAILDEBUG', '') - -# used by a couple of routines -chars = string.letters+string.digits - -# XXX actually _use_ FormError -class FormError(ValueError): - ''' An "expected" exception occurred during form parsing. - - ie. something we know can go wrong, and don't want to alarm the - user with - - We trap this at the user interface level and feed back a nice error - to the user. - ''' - pass - -class SendFile(Exception): - ''' Send a file from the database ''' - -class SendStaticFile(Exception): - ''' Send a static file from the instance html directory ''' +__docformat__ = 'restructuredtext' + +import base64, binascii, cgi, codecs, mimetypes, os +import quopri, random, re, rfc822, stat, sys, time +import socket, errno +from traceback import format_exc + +from roundup import roundupdb, date, hyperdb, password +from roundup.cgi import templating, cgitb, TranslationService +from roundup.cgi.actions import * +from roundup.exceptions import * +from roundup.cgi.exceptions import * +from roundup.cgi.form_parser import FormParser +from roundup.mailer import Mailer, MessageSendError, encode_quopri +from roundup.cgi import accept_language +from roundup import xmlrpc + +from roundup.anypy.cookie_ import CookieError, BaseCookie, SimpleCookie, \ + get_cookie_date +from roundup.anypy.io_ import StringIO +from roundup.anypy import http_ +from roundup.anypy import urllib_ + +from email.MIMEBase import MIMEBase +from email.MIMEText import MIMEText +from email.MIMEMultipart import MIMEMultipart def initialiseSecurity(security): - ''' Create some Permissions and Roles on the security object + '''Create some Permissions and Roles on the security object - This function is directly invoked by security.Security.__init__() - as a part of the Security object instantiation. + This function is directly invoked by security.Security.__init__() + as a part of the Security object instantiation. ''' - security.addPermission(name="Web Registration", - description="User may register through the web") p = security.addPermission(name="Web Access", description="User may access the web interface") security.addPermissionToRole('Admin', p) # doing Role stuff through the web - make sure Admin can + # TODO: deprecate this and use a property-based control p = security.addPermission(name="Web Roles", description="User may manipulate user Roles through the web") security.addPermissionToRole('Admin', p) +# used to clean messages passed through CGI variables - HTML-escape any tag +# that isn't , , and
(including XHTML variants) so +# that people can't pass through nasties like