Performance improvement in XML marshaller by mimicking StringIO in unicode-friendly buffer UnicodeBuffer and added a class appy.gen.No allowing to explain why some workflow condition cannot be triggered.

This commit is contained in:
Gaetan Delannay 2010-02-05 15:39:52 +01:00
parent 50619f28c0
commit d398d5bcfc
4 changed files with 20 additions and 7 deletions

View file

@ -581,6 +581,17 @@ class Permission:
class ReadPermission(Permission): pass
class WritePermission(Permission): pass
class No:
'''When you write a workflow condition method and you want to return False
but you want to give to the user some explanations about why a transition
can't be triggered, do not return False, return an instance of No
instead. When creating such an instance, you can specify an error
message.'''
def __init__(self, msg):
self.msg = msg
def __nonzero__(self):
return False
# ------------------------------------------------------------------------------
class Selection:
'''Instances of this class may be given as validator of a String, in order

View file

@ -3,6 +3,8 @@ import os, os.path, time, unicodedata
from appy.shared import mimeTypes
from appy.gen.plone25.mixins import AbstractMixin
from StringIO import StringIO
import appy.pod
from appy.pod.renderer import Renderer
# ------------------------------------------------------------------------------
class PodError(Exception): pass
@ -81,8 +83,6 @@ class PodTemplateMixin(AbstractMixin):
if appySelf.tool.openOfficePort:
rendererParams['ooPort'] = appySelf.tool.openOfficePort
# Launch the renderer
import appy.pod
from appy.pod.renderer import Renderer
try:
renderer = Renderer(**rendererParams)
renderer.run()