from zope.interface import Interface, Attribute class ParserError(Exception): pass class MyInterface(Interface): def setDict(self, attr, key, value): dict=self.get(attr) dict[key]=value try: self.set(attr,dict) except: self.setTaggedValue(attr,dict) class ParserPlugin(MyInterface): """ A python interface to a parser of some sort """ running = Attribute(""" The enabled state of the parser """) displayName = Attribute(""" The name of the tokenizer """) preferences = Attribute(""" A dictionary of config values and their types """) values = Attribute(""" A dictionary of config attributes and their values """) def start(self): for p in self.preferences: p=Attribute(""" I have no value. """) """ Start the tokenizer """ def stop(self): """ Stop the tokenizer """ def parse(self, tokenList): """ Parse a list of tokens """ def version(self): """ Return the version string of the tokenizer """ def preferences(self): """ Return a list of config values to store """