Changeset 3966
- Timestamp:
- 07/05/08 13:42:26 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
tracformsplugin/branches/tracforms-0.2/0.11/tracforms/macros.py
r3946 r3966 4 4 import sys, StringIO, re, traceback, cgi, time, fnmatch 5 5 from iface import TracFormDBUser, TracPasswordStoreUser 6 from errors import TracFormError, \ 7 TracFormTooManyValuesError, \ 8 TracFormNoOperationError, \ 9 TracFormNoCommandError 6 10 7 11 argRE = re.compile('\s*(".*?"|\'.*?\'|\S+)\s*') … … 60 64 # Setup preliminary context 61 65 self.page = formatter.req.path_info 66 if self.page == '/wiki' or self.page == '/wiki/': 67 self.page = '/wiki/WikiStart' 62 68 63 69 # Remove leading comments and process commands. … … 82 88 try: 83 89 fn(*args, **kw) 90 except TracFormError, e: 91 errors.append(str(e)) 84 92 except Exception, e: 85 93 errors.append(traceback.format_exc()) … … 321 329 op = getattr(_self, 'op_' + _op, None) 322 330 if op is None: 323 r eturn 'ERROR: No operation named %r' % str(_name)331 raise TracFormTooManyValuesError(str(_name)) 324 332 def partial(*_newargs, **_newkw): 325 333 if _kw or _newkw: … … 346 354 fn = getattr(self, 'op_' + op.lower(), None) 347 355 if fn is None: 348 r eturn 'ERROR: No TracForm operation "%s"' % str(op)356 raise TracFormTooManyValuesError(str(op)) 349 357 else: 350 358 try: … … 353 361 else: 354 362 return str(fn(*args, **kw)) 363 except TracFormError, e: 364 return '<PRE>' + str(e) + '</PRE>' 355 365 except Exception, e: 356 366 return '<PRE>' + traceback.format_exc() + '</PRE>' … … 370 380 current = current[0] 371 381 else: 372 r eturn 'ERROR: field %r has too many values' % str(name)382 raise TracFormTooManyValuesError(str(name)) 373 383 return current 374 384
