Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1421:90bb11eb40dc
oops, forgot the templating :)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 12 Feb 2003 07:02:24 +0000 |
| parents | 3ac43c62a250 |
| children | 5599f1990325 |
comparison
equal
deleted
inserted
replaced
| 1420:3ac43c62a250 | 1421:90bb11eb40dc |
|---|---|
| 1 # $Id: client.py,v 1.79 2003-02-12 06:41:58 richard Exp $ | 1 # $Id: client.py,v 1.80 2003-02-12 07:02:22 richard Exp $ |
| 2 | 2 |
| 3 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 87 | 87 |
| 88 : @ + | 88 : @ + |
| 89 | 89 |
| 90 ''' | 90 ''' |
| 91 | 91 |
| 92 # | |
| 92 # special form variables | 93 # special form variables |
| 94 # | |
| 93 FV_TEMPLATE = re.compile(r'[@+:]template') | 95 FV_TEMPLATE = re.compile(r'[@+:]template') |
| 94 FV_OK_MESSAGE = re.compile(r'[@+:]ok_message') | 96 FV_OK_MESSAGE = re.compile(r'[@+:]ok_message') |
| 95 FV_ERROR_MESSAGE = re.compile(r'[@+:]error_message') | 97 FV_ERROR_MESSAGE = re.compile(r'[@+:]error_message') |
| 98 | |
| 99 # specials for parsePropsFromForm | |
| 96 FV_REQUIRED = re.compile(r'[@+:]required') | 100 FV_REQUIRED = re.compile(r'[@+:]required') |
| 97 FV_LINK = re.compile(r'[@+:]link') | |
| 98 FV_MULTILINK = re.compile(r'[@+:]multilink') | |
| 99 FV_NOTE = re.compile(r'[@+:]note') | |
| 100 FV_FILE = re.compile(r'[@+:]file') | |
| 101 FV_ADD = re.compile(r'([@+:])add\1') | 101 FV_ADD = re.compile(r'([@+:])add\1') |
| 102 FV_REMOVE = re.compile(r'([@+:])remove\1') | 102 FV_REMOVE = re.compile(r'([@+:])remove\1') |
| 103 FV_CONFIRM = re.compile(r'.+[@+:]confirm') | 103 FV_CONFIRM = re.compile(r'.+[@+:]confirm') |
| 104 FV_SPLITTER = re.compile(r'[@+:]') | 104 |
| 105 # post-edi | |
| 106 FV_LINK = re.compile(r'[@+:]link') | |
| 107 FV_MULTILINK = re.compile(r'[@+:]multilink') | |
| 108 | |
| 109 # deprecated | |
| 110 FV_NOTE = re.compile(r'[@+:]note') | |
| 111 FV_FILE = re.compile(r'[@+:]file') | |
| 112 | |
| 113 # Note: index page stuff doesn't appear here: | |
| 114 # columns, sort, sortdir, filter, group, groupdir, search_text, | |
| 115 # pagesize, startwith | |
| 105 | 116 |
| 106 def __init__(self, instance, request, env, form=None): | 117 def __init__(self, instance, request, env, form=None): |
| 107 hyperdb.traceMark() | 118 hyperdb.traceMark() |
| 108 self.instance = instance | 119 self.instance = instance |
| 109 self.request = request | 120 self.request = request |
| 651 | 662 |
| 652 # create the new user | 663 # create the new user |
| 653 cl = self.db.user | 664 cl = self.db.user |
| 654 try: | 665 try: |
| 655 props['roles'] = self.instance.config.NEW_WEB_USER_ROLES | 666 props['roles'] = self.instance.config.NEW_WEB_USER_ROLES |
| 656 self.userid = cl.create(**props) | 667 self.userid = cl.create(**props['user']) |
| 657 self.db.commit() | 668 self.db.commit() |
| 658 except (ValueError, KeyError), message: | 669 except (ValueError, KeyError), message: |
| 659 self.error_message.append(message) | 670 self.error_message.append(message) |
| 660 return | 671 return |
| 661 | 672 |
| 722 self.error_message.append( | 733 self.error_message.append( |
| 723 _('You do not have permission to edit %(classname)s'% | 734 _('You do not have permission to edit %(classname)s'% |
| 724 self.__dict__)) | 735 self.__dict__)) |
| 725 return | 736 return |
| 726 | 737 |
| 738 # identify the entry in the props parsed from the form | |
| 739 this = self.classname + self.nodeid | |
| 740 | |
| 727 # perform the edit | 741 # perform the edit |
| 728 try: | 742 try: |
| 729 # make changes to the node | 743 # make changes to the node |
| 730 props = self._changenode(props) | 744 props = self._changenode(props[this]) |
| 731 # handle linked nodes | 745 # handle linked nodes |
| 732 self._post_editnode(self.nodeid) | 746 self._post_editnode(self.nodeid) |
| 733 except (ValueError, KeyError, IndexError), message: | 747 except (ValueError, KeyError, IndexError), message: |
| 734 self.error_message.append(_('Error: ') + str(message)) | 748 self.error_message.append(_('Error: ') + str(message)) |
| 735 return | 749 return |
| 801 designator, linkprop = link.split(':') | 815 designator, linkprop = link.split(':') |
| 802 xtra = ' for <a href="%s">%s</a>'%(designator, designator) | 816 xtra = ' for <a href="%s">%s</a>'%(designator, designator) |
| 803 | 817 |
| 804 try: | 818 try: |
| 805 # do the create | 819 # do the create |
| 806 nid = self._createnode(props) | 820 nid = self._createnode(props[self.classname]) |
| 807 except (ValueError, KeyError, IndexError), message: | 821 except (ValueError, KeyError, IndexError), message: |
| 808 # these errors might just be indicative of user dumbness | 822 # these errors might just be indicative of user dumbness |
| 809 self.error_message.append(_('Error: ') + str(message)) | 823 self.error_message.append(_('Error: ') + str(message)) |
| 810 return | 824 return |
| 811 except: | 825 except: |
