Code

Features added:
authorrochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 20 Dec 2001 15:43:01 +0000 (15:43 +0000)
committerrochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2>
Thu, 20 Dec 2001 15:43:01 +0000 (15:43 +0000)
 .  Multilink properties are now displayed as comma separated values in
    a textbox
 .  The add user link is now only visible to the admin user
 .  Modified the mail gateway to reject submissions from unknown
    addresses if ANONYMOUS_ACCESS is denied

git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@479 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi_client.py
roundup/htmltemplate.py
roundup/mailgw.py
roundup/roundupdb.py
roundup/templates/classic/interfaces.py
roundup/templates/extended/interfaces.py

index c8e1fef6699c13615b57b525dfcfe7275284b6f0..5a78b17cd3677cc040ac5043b5a6750cde15ca3f 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: cgi_client.py,v 1.85 2001-12-20 06:13:24 rochecompaan Exp $
+# $Id: cgi_client.py,v 1.86 2001-12-20 15:43:01 rochecompaan Exp $
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
 
 __doc__ = """
 WWW request handler (also used in the stand-alone server).
@@ -120,10 +120,16 @@ class Client:
         else:
             user_info = _('<a href="login">Login</a>')
         if self.user is not None:
         else:
             user_info = _('<a href="login">Login</a>')
         if self.user is not None:
-            add_links = _('''
+            if self.user == 'admin':
+                add_links = _('''
 | Add
 <a href="newissue">Issue</a>,
 <a href="newuser">User</a>
 | Add
 <a href="newissue">Issue</a>,
 <a href="newuser">User</a>
+''')
+            else:
+                add_links = _('''
+| Add
+<a href="newissue">Issue</a>
 ''')
         else:
             add_links = ''
 ''')
         else:
             add_links = ''
@@ -1059,11 +1065,18 @@ class ExtendedClient(Client):
         else:
             user_info = _('<a href="login">Login</a>')
         if self.user is not None:
         else:
             user_info = _('<a href="login">Login</a>')
         if self.user is not None:
-            add_links = _('''
+            if self.user == 'admin':
+                add_links = _('''
 | Add
 <a href="newissue">Issue</a>,
 <a href="newsupport">Support</a>,
 <a href="newuser">User</a>
 | Add
 <a href="newissue">Issue</a>,
 <a href="newsupport">Support</a>,
 <a href="newuser">User</a>
+''')
+            else:
+                add_links = _('''
+| Add
+<a href="newissue">Issue</a>,
+<a href="newsupport">Support</a>,
 ''')
         else:
             add_links = ''
 ''')
         else:
             add_links = ''
@@ -1163,6 +1176,16 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.85  2001/12/20 06:13:24  rochecompaan
+# Bugs fixed:
+#   . Exception handling in hyperdb for strings-that-look-like numbers got
+#     lost somewhere
+#   . Internet Explorer submits full path for filename - we now strip away
+#     the path
+# Features added:
+#   . Link and multilink properties are now displayed sorted in the cgi
+#     interface
+#
 # Revision 1.84  2001/12/18 15:30:30  rochecompaan
 # Fixed bugs:
 #  .  Fixed file creation and retrieval in same transaction in anydbm
 # Revision 1.84  2001/12/18 15:30:30  rochecompaan
 # Fixed bugs:
 #  .  Fixed file creation and retrieval in same transaction in anydbm
index ea2981f56a320997b38bb3e329d6e09e0598f358..f0d12d492b5afe7f80b3207b0f8454d347914c33 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: htmltemplate.py,v 1.48 2001-12-20 06:13:24 rochecompaan Exp $
+# $Id: htmltemplate.py,v 1.49 2001-12-20 15:43:01 rochecompaan Exp $
 
 __doc__ = """
 Template engine.
 
 __doc__ = """
 Template engine.
@@ -178,23 +178,24 @@ class TemplateFunctions:
         elif isinstance(propclass, hyperdb.Multilink):
             list = linkcl.list()
             list.sort(sortfunc)
         elif isinstance(propclass, hyperdb.Multilink):
             list = linkcl.list()
             list.sort(sortfunc)
-            height = height or min(len(list), 7)
-            l = ['<select multiple name="%s" size="%s">'%(property, height)]
             k = linkcl.labelprop()
             k = linkcl.labelprop()
-            for optionid in list:
-                option = linkcl.get(optionid, k)
-                s = ''
-                if optionid in value:
-                    s = 'selected '
-                if showid:
-                    lab = '%s%s: %s'%(propclass.classname, optionid, option)
+            l = []
+            # special treatment for nosy list
+            if property == 'nosy':
+                input_value = []
+            else:
+                input_value = value
+            for v in value:
+                lab = linkcl.get(v, k)
+                if property != 'nosy':
+                    l.append('<a href="issue%s">%s: %s</a>'%(v,v,lab))
                 else:
                 else:
-                    lab = option
-                if size is not None and len(lab) > size:
-                    lab = lab[:size-3] + '...'
-                l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
-            l.append('</select>')
-            s = '\n'.join(l)
+                    input_value.append(lab)
+            if size is None:
+                size = '10'
+            l.insert(0,'<input name="%s" size="%s" value="%s">'%(property, 
+                size, ','.join(input_value)))
+            s = "<br>\n".join(l)
         else:
             s = 'Plain: bad propclass "%s"'%propclass
         return s
         else:
             s = 'Plain: bad propclass "%s"'%propclass
         return s
@@ -884,6 +885,16 @@ class NewItemTemplate(TemplateFunctions):
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.48  2001/12/20 06:13:24  rochecompaan
+# Bugs fixed:
+#   . Exception handling in hyperdb for strings-that-look-like numbers got
+#     lost somewhere
+#   . Internet Explorer submits full path for filename - we now strip away
+#     the path
+# Features added:
+#   . Link and multilink properties are now displayed sorted in the cgi
+#     interface
+#
 # Revision 1.47  2001/11/26 22:55:56  richard
 # Feature:
 #  . Added INSTANCE_NAME to configuration - used in web and email to identify
 # Revision 1.47  2001/11/26 22:55:56  richard
 # Feature:
 #  . Added INSTANCE_NAME to configuration - used in web and email to identify
index f533c755f4ddac8026463f29c36157c1c0f20ac7..9b3c1411deba5bcf8935fa6aa1b2439f23dab116 100644 (file)
@@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
-$Id: mailgw.py,v 1.44 2001-12-18 15:30:34 rochecompaan Exp $
+$Id: mailgw.py,v 1.45 2001-12-20 15:43:01 rochecompaan Exp $
 '''
 
 
 '''
 
 
@@ -87,6 +87,9 @@ class MailGWError(ValueError):
 class MailUsageError(ValueError):
     pass
 
 class MailUsageError(ValueError):
     pass
 
+class UnAuthorized(Exception):
+    """ Access denied """
+
 class Message(mimetools.Message):
     ''' subclass mimetools.Message so we can retrieve the parts of the
         message...
 class Message(mimetools.Message):
     ''' subclass mimetools.Message so we can retrieve the parts of the
         message...
@@ -148,6 +151,12 @@ class MailGW:
                 m.append('\n\nMail Gateway Help\n=================')
                 m.append(fulldoc)
                 m = self.bounce_message(message, sendto, m)
                 m.append('\n\nMail Gateway Help\n=================')
                 m.append(fulldoc)
                 m = self.bounce_message(message, sendto, m)
+            except UnAuthorized, value:
+                # just inform the user that he is not authorized
+                sendto = [sendto[0][1]]
+                m = ['']
+                m.append(str(value))
+                m = self.bounce_message(message, sendto, m)
             except:
                 # bounce the message back to the sender with the error message
                 sendto = [sendto[0][1]]
             except:
                 # bounce the message back to the sender with the error message
                 sendto = [sendto[0][1]]
@@ -366,7 +375,21 @@ Subject was: "%s"
         #
         # handle the users
         #
         #
         # handle the users
         #
-        author = self.db.uidFromAddress(message.getaddrlist('from')[0])
+
+        # Don't create users if ANONYMOUS_ACCESS is denied
+        if self.ANONYMOUS_ACCESS == 'deny':
+            create = 0
+        else:
+            create = 1
+        author = self.db.uidFromAddress(message.getaddrlist('from')[0],
+            create=create)
+        if not author:
+            raise UnAuthorized, '''
+You are not a registered user.
+
+Unknown address: %s
+'''%message.getaddrlist('from')[0][1]
+            
         # reopen the database as the author
         username = self.db.user.get(author, 'username')
         self.db = self.instance.open(username)
         # reopen the database as the author
         username = self.db.user.get(author, 'username')
         self.db = self.instance.open(username)
@@ -638,6 +661,15 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.44  2001/12/18 15:30:34  rochecompaan
+# Fixed bugs:
+#  .  Fixed file creation and retrieval in same transaction in anydbm
+#     backend
+#  .  Cgi interface now renders new issue after issue creation
+#  .  Could not set issue status to resolved through cgi interface
+#  .  Mail gateway was changing status back to 'chatting' if status was
+#     omitted as an argument
+#
 # Revision 1.43  2001/12/15 19:39:01  rochecompaan
 # Oops.
 #
 # Revision 1.43  2001/12/15 19:39:01  rochecompaan
 # Oops.
 #
index 50cd90c4dcca11d9a69076be33364dba63e56d3a..603e608ed35f13f0d2a1733f149f1a9172c1f4b2 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.34 2001-12-17 03:52:48 richard Exp $
+# $Id: roundupdb.py,v 1.35 2001-12-20 15:43:01 rochecompaan Exp $
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
@@ -71,8 +71,11 @@ class Database:
             users = self.user.stringFind(username=address)
 
         # couldn't match address or username, so create a new user
             users = self.user.stringFind(username=address)
 
         # couldn't match address or username, so create a new user
-        return self.user.create(username=address, address=address,
-            realname=realname)
+        if create:
+            return self.user.create(username=address, address=address,
+                realname=realname)
+        else:
+            return 0
 
 _marker = []
 # XXX: added the 'creator' faked attribute
 
 _marker = []
 # XXX: added the 'creator' faked attribute
@@ -492,6 +495,13 @@ class IssueClass(Class):
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.34  2001/12/17 03:52:48  richard
+# Implemented file store rollback. As a bonus, the hyperdb is now capable of
+# storing more than one file per node - if a property name is supplied,
+# the file is called designator.property.
+# I decided not to migrate the existing files stored over to the new naming
+# scheme - the FileClass just doesn't specify the property name.
+#
 # Revision 1.33  2001/12/16 10:53:37  richard
 # take a copy of the node dict so that the subsequent set
 # operation doesn't modify the oldvalues structure
 # Revision 1.33  2001/12/16 10:53:37  richard
 # take a copy of the node dict so that the subsequent set
 # operation doesn't modify the oldvalues structure
index 72c2cbb629851ac3c97b07c36eb58b4ffa45718e..ac2acc7aa76ab90843a035d47b742314f231325b 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: interfaces.py,v 1.9 2001-11-26 23:00:53 richard Exp $
+# $Id: interfaces.py,v 1.10 2001-12-20 15:43:01 rochecompaan Exp $
 
 import instance_config
 from roundup import cgi_client, mailgw 
 
 import instance_config
 from roundup import cgi_client, mailgw 
@@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW):
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
+    ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.9  2001/11/26 23:00:53  richard
+# This config stuff is getting to be a real mess...
+#
 # Revision 1.8  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)
 # Revision 1.8  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)
index bfe9269a36bf5170aa79c751dc17323739d66956..8f84e668a8af384da6cadd2f2be62e94516edd81 100644 (file)
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: interfaces.py,v 1.13 2001-11-26 23:00:53 richard Exp $
+# $Id: interfaces.py,v 1.14 2001-12-20 15:43:01 rochecompaan Exp $
 
 import instance_config
 from roundup import cgi_client, mailgw 
 
 import instance_config
 from roundup import cgi_client, mailgw 
@@ -38,9 +38,13 @@ class MailGW(mailgw.MailGW):
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
     ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
     ADMIN_EMAIL = instance_config.ADMIN_EMAIL
     MAILHOST = instance_config.MAILHOST
+    ANONYMOUS_ACCESS = instance_config.ANONYMOUS_ACCESS
 
 #
 # $Log: not supported by cvs2svn $
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.13  2001/11/26 23:00:53  richard
+# This config stuff is getting to be a real mess...
+#
 # Revision 1.12  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)
 # Revision 1.12  2001/10/22 03:25:01  richard
 # Added configuration for:
 #  . anonymous user access and registration (deny/allow)