<s> import colander <EOL> import deform . widget <EOL> from persistent import Persistent <EOL> from substanced . content import content <EOL> from substanced . property import PropertySheet <EOL> from substanced . schema import ( <EOL> Schema , <EOL> NameSchemaNode <EOL> ) <EOL> from substanced . util import renamer <EOL> def context_is_a_document ( context , request ) : <EOL> return request . registry . content . istype ( context , '<STR_LIT>' ) <EOL> class DocumentSchema ( Schema ) : <EOL> name = NameSchemaNode ( <EOL> editing = context_is_a_document , <EOL> ) <EOL> title = colander . SchemaNode ( <EOL> colander . String ( ) , <EOL> ) <EOL> body = colander . SchemaNode ( <EOL> colander . String ( ) , <EOL> widget = deform . widget . RichTextWidget ( ) <EOL> ) <EOL> class DocumentPropertySheet ( PropertySheet ) : <EOL> schema = DocumentSchema ( ) <EOL> @ content ( <EOL> '<STR_LIT>' , <EOL> icon = '<STR_LIT>' , <EOL> add_view = '<STR_LIT>' , <EOL> ) <EOL> class Document ( Persistent ) : <EOL> name = renamer ( ) <EOL> def __init__ ( self , title = '<STR_LIT>' , body = '<STR_LIT>' ) : <EOL> self . title = title <EOL> self . body = body <EOL> def includeme ( config ) : <EOL> config . add_propertysheet ( '<STR_LIT>' , DocumentPropertySheet , Document ) </s>
