def init(config): """ init function """ merge_config(config, VALIDATOR_CONFIG) TIDDLER_VALIDATORS.append(validate)
tiddler.tags = [] tiddler.fields = {} tiddler.fields['mapped_user'] = environ['tiddlyweb.usersign']['name'] return tiddler def validate_mapspace(tiddler, environ): """ If a tiddler is put to the MAPSPACE bag clear out the tiddler and set fields['mapped_space'] to the current space. Elsewhere in the space the mapped_space can map a alien domain to space. """ if tiddler.bag == 'MAPSPACE': current_space = determine_space(environ, determine_host(environ)[0]) recipe_name = determine_space_recipe(environ, current_space) if recipe_name != '%s_private' % current_space: raise InvalidTiddlerError('non member may not map space') tiddler.text = '' tiddler.tags = [] tiddler.fields = {} tiddler.fields['mapped_space'] = current_space return tiddler TIDDLER_VALIDATORS.append(validate_mapuser) TIDDLER_VALIDATORS.append(validate_mapspace)
def init(config): TIDDLER_VALIDATORS.append(lowerit)
def init(config_in): """ init function """ TIDDLER_VALIDATORS.append(validate_tiddlywiki)
call(['convert', svgPath, pngPath]) try: f = open(pngPath, "rb") return f.readlines() except IOError: return "" def list_tiddlers(self, bag): return "" def list_recipes(self, recipes): return "" def list_bags(self, bags): return "" def update_image_cache(tiddler, environ): path = "%s/%s/%s.png"%(CACHE_LOCATION, tiddler.bag, tiddler.title) svgPath = "%s.svg"%path pngPath = "%s.png"%path if ".." not in path: try: os.remove(svgPath) except OSError: pass try: os.remove(pngPath) except OSError: pass TIDDLER_VALIDATORS.append(update_image_cache)
def setup_validator(): TIDDLER_VALIDATORS.extend([tiddlyvoting_validator])
def init(config): """ add the validator to the current list """ TIDDLER_VALIDATORS.append(check_recaptcha)
return f.readlines() except IOError: return "" def list_tiddlers(self, bag): return "" def list_recipes(self, recipes): return "" def list_bags(self, bags): return "" def update_image_cache(tiddler, environ): path = "%s/%s/%s.png" % (CACHE_LOCATION, tiddler.bag, tiddler.title) svgPath = "%s.svg" % path pngPath = "%s.png" % path if ".." not in path: try: os.remove(svgPath) except OSError: pass try: os.remove(pngPath) except OSError: pass TIDDLER_VALIDATORS.append(update_image_cache)
def make_validators(): BAG_VALIDATORS.append(bag_quota) TIDDLER_VALIDATORS.append(binary_trap)
def init(config_in): """ init function """ TIDDLER_VALIDATORS.append(sanitise_xss)