|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: cgi_client.py,v 1.40 2001-10-23 23:06:39 richard Exp $ |
| 18 | +# $Id: cgi_client.py,v 1.41 2001-10-23 23:52:35 richard Exp $ |
19 | 19 |
|
20 | 20 | import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes |
21 | 21 | import base64, Cookie, time |
@@ -512,7 +512,7 @@ def login(self, message=None): |
512 | 512 | <td><input type="submit" value="Log In"></td></tr> |
513 | 513 | </form> |
514 | 514 | ''') |
515 | | - if self.user is None and not self.ANONYMOUS_REGISTER == 'deny': |
| 515 | + if self.user is None and self.ANONYMOUS_REGISTER == 'deny': |
516 | 516 | self.write('</table') |
517 | 517 | return |
518 | 518 | self.write(''' |
@@ -587,7 +587,7 @@ def logout(self, message=None): |
587 | 587 | now = Cookie._getdate() |
588 | 588 | self.header({'Set-Cookie': |
589 | 589 | 'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)}) |
590 | | - return self.index() |
| 590 | + return self.login() |
591 | 591 |
|
592 | 592 | def newuser_action(self, message=None): |
593 | 593 | ''' create a new user based on the contents of the form and then |
@@ -644,31 +644,35 @@ def main(self, dre=re.compile(r'([^\d]+)(\d+)'), |
644 | 644 | # now figure which function to call |
645 | 645 | path = self.split_path |
646 | 646 | if not path or path[0] in ('', 'index'): |
647 | | - return self.index() |
648 | | - elif not path: |
649 | | - raise 'ValueError', 'Path not understood' |
| 647 | + action = 'index' |
| 648 | + else: |
| 649 | + action = path[0] |
650 | 650 |
|
651 | | - # |
652 | 651 | # Everthing ignores path[1:] |
653 | | - # |
654 | | - # The file download link generator actually relies on this - it |
655 | | - # appends the name of the file to the URL so the download file name |
656 | | - # is correct, but doesn't actually use it. |
657 | | - action = path[0] |
| 652 | + # - The file download link generator actually relies on this - it |
| 653 | + # appends the name of the file to the URL so the download file name |
| 654 | + # is correct, but doesn't actually use it. |
| 655 | + |
| 656 | + # everyone is allowed to try to log in |
658 | 657 | if action == 'login_action': |
659 | 658 | return self.login_action() |
660 | 659 |
|
661 | | - # make sure anonymous are allowed to register |
| 660 | + # if we don't have a login and anonymous people aren't allowed to |
| 661 | + # register, then spit up the login form |
662 | 662 | if self.ANONYMOUS_REGISTER == 'deny' and self.user is None: |
663 | 663 | return self.login() |
664 | 664 |
|
| 665 | + # allow anonymous people to register |
665 | 666 | if action == 'newuser_action': |
666 | 667 | return self.newuser_action() |
667 | 668 |
|
668 | 669 | # make sure totally anonymous access is OK |
669 | 670 | if self.ANONYMOUS_ACCESS == 'deny' and self.user is None: |
670 | 671 | return self.login() |
671 | 672 |
|
| 673 | + # here be the "normal" functionality |
| 674 | + if action == 'index': |
| 675 | + return self.index() |
672 | 676 | if action == 'list_classes': |
673 | 677 | return self.classes() |
674 | 678 | if action == 'login': |
@@ -845,6 +849,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0): |
845 | 849 |
|
846 | 850 | # |
847 | 851 | # $Log: not supported by cvs2svn $ |
| 852 | +# Revision 1.40 2001/10/23 23:06:39 richard |
| 853 | +# Some cleanup. |
| 854 | +# |
848 | 855 | # Revision 1.39 2001/10/23 01:00:18 richard |
849 | 856 | # Re-enabled login and registration access after lopping them off via |
850 | 857 | # disabling access for anonymous users. |
|
0 commit comments