If I have an interface (IDvText) and a class DvText (shown below). and I want it to act exactly as a zope.schema Textline (with some additional attributes) then is this correct and how do I (where do I find how to) register/add to the TextLine widget? Apologies for the line wraps.
****************************************************** from zope.schema import TextLine,Text,List,Dict,URI,Object from zope.i18nmessageid.message import MessageFactory from zope.interface import Interface from interfaces.codephrase import ICodePhrase from oship.openehr.rm.support.identification.interfaces.objectref import IObjectRef _ = MessageFactory('oship') class IDvText(Interface): """ blah blah! """ value = TextLine( title = _(u"Value"), description = _(u"""Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service. No carriage returns, line feeds, or other non-printing characters permitted."""), ) mappings=List( value_type=Object(schema=IObjectRef), title = _(u"Mappings"), description = _(u"""A list of MappingTerm,terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from wellknown terminologies (e.g. LOINC). The list contents should be of the type TermMapping"""), required = False, ) formatting = Text( title = _(u"Formatting"), description = _(u"""A format string of the form "name:value; name:value...", e.g. "font-weight : bold; font-family : Arial; font-size : 12pt;". Values taken from W3C CSS2 properties lists "background" and "font"."""), required = False ) hyperlink = URI( title = _(u"Hyperlink"), description = _(u"""Optional link sitting behind a section of plain text or coded term item as type DvUri."""), required = False ) language = Object( schema = ICodePhrase, title = _(u"Language"), description = _(u"""Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set "languages". Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language."""), required = False ) encoding = Object( schema = ICodePhrase, title = _(u"Encoding"), description = _(u"""Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set "character sets". Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions."""), required = False ) ****************************************************** from zope.interface import implements from zope.i18nmessageid.message import MessageFactory from zope.schema import TextLine from interfaces.dvtext import IDvText _ = MessageFactory('oship') class DvText(TextLine): """ blah blah! """ implements(IDvText) def __init__(self, value, mappings=None, formatting=None, hyperlink=None, language=None, encoding=None): self.value = value self.mappings = mappings self.formatting = formatting self.hyperlink = hyperlink self.language = language self.encoding = encoding **************************************************************
<<attachment: oe_trick.png>>
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users