Changeset 3966

Show
Ignore:
Timestamp:
07/05/08 13:42:26 (5 months ago)
Author:
rharkins
Message:

Fixed issue #3300.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tracformsplugin/branches/tracforms-0.2/0.11/tracforms/macros.py

    r3946 r3966  
    44import sys, StringIO, re, traceback, cgi, time, fnmatch 
    55from iface import TracFormDBUser, TracPasswordStoreUser 
     6from errors import TracFormError, \ 
     7    TracFormTooManyValuesError, \ 
     8    TracFormNoOperationError, \ 
     9    TracFormNoCommandError 
    610 
    711argRE = re.compile('\s*(".*?"|\'.*?\'|\S+)\s*') 
     
    6064        # Setup preliminary context 
    6165        self.page = formatter.req.path_info 
     66        if self.page == '/wiki' or self.page == '/wiki/': 
     67            self.page = '/wiki/WikiStart' 
    6268 
    6369        # Remove leading comments and process commands. 
     
    8288                            try: 
    8389                                fn(*args, **kw) 
     90                            except TracFormError, e: 
     91                                errors.append(str(e)) 
    8492                            except Exception, e: 
    8593                                errors.append(traceback.format_exc()) 
     
    321329        op = getattr(_self, 'op_' + _op, None) 
    322330        if op is None: 
    323             return 'ERROR: No operation named %r' % str(_name
     331            raise TracFormTooManyValuesError(str(_name)
    324332        def partial(*_newargs, **_newkw): 
    325333            if _kw or _newkw: 
     
    346354            fn = getattr(self, 'op_' + op.lower(), None) 
    347355        if fn is None: 
    348             return 'ERROR: No TracForm operation "%s"' % str(op
     356            raise TracFormTooManyValuesError(str(op)
    349357        else: 
    350358            try: 
     
    353361                else: 
    354362                    return str(fn(*args, **kw)) 
     363            except TracFormError, e: 
     364                return '<PRE>' + str(e) + '</PRE>' 
    355365            except Exception, e: 
    356366                return '<PRE>' + traceback.format_exc() + '</PRE>' 
     
    370380                current = current[0] 
    371381            else: 
    372                 return 'ERROR: field %r has too many values' % str(name
     382                raise TracFormTooManyValuesError(str(name)
    373383        return current 
    374384