[Zope3-checkins] Re: [Checkins] SVN: Zope3/branches/3.3/src/zope/app/schema/ Don't need meta slug anymore.

Jim Fulton jim at zope.com
Wed Jul 19 12:42:31 EDT 2006


Sorry, I accidentally combined 2 checkins.  See the trunk checkins.

Jim

On Jul 19, 2006, at 11:43 AM, Jim Fulton wrote:

> Log message for revision 69202:
>   Don't need meta slug anymore.
>
> Changed:
>   D   Zope3/branches/3.3/src/zope/app/schema/browser/
>   U   Zope3/branches/3.3/src/zope/app/schema/configure.zcml
>   D   Zope3/branches/3.3/src/zope/app/schema/fieldforms.zcml
>   D   Zope3/branches/3.3/src/zope/app/schema/fields.zcml
>   D   Zope3/branches/3.3/src/zope/app/schema/interfaces.py
>   D   Zope3/branches/3.3/src/zope/app/schema/schema.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/fields.zcml
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/test_field.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.zcml
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_interfaceutility.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautility.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautilitypersistence.py
>   D   Zope3/branches/3.3/src/zope/app/schema/tests/test_wrapper.py
>   D   Zope3/branches/3.3/src/zope/app/schema/wrapper.py
>   D   Zope3/branches/3.3/src/zope/app/schema/zope.app.schema-meta.zcml
>
> -=-
> Modified: Zope3/branches/3.3/src/zope/app/schema/configure.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/configure.zcml	 
> 2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/configure.zcml	 
> 2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,27 +1,359 @@
>  <configure xmlns="http://namespaces.zope.org/zope"  
> i18n_domain="zope">
>
> -  <localUtility class=".schema.SchemaUtility">
> +  <class class="zope.schema.Field">
>
>      <factory
> -        title="Mutable Schema"
> -        description="A Persistent Schema that can be edited  
> through the web"/>
> +        id="zope.schema.Field"
> +	title="Basic Field"
> +	description="Basic Field" />
>
> +    <implements interface="zope.interface.interfaces.IAttribute" />
> +
> +    <!--
>      <require
> -        permission="zope.ManageServices"
> -        interface=".interfaces.IMutableSchema" />
> +	permission="zope.View"
> +	interface="zope.schema.interfaces.IField"
> +	/>
>
>      <require
> -        permission="zope.ManageServices"
> -        interface=".interfaces.ISchemaUtility"
> -        set_schema=".interfaces.ISchemaUtility" />
> +	permission="zope.ManageContent"
> +	attributes="bind set"
> +	/>
> +    -->
>
> -  </localUtility>
> +    <allow attributes="__name__" />
>
> -  <subscriber handler=".schema.schemaUtilityRegistered" />
> -  <subscriber handler=".schema.schemaUtilityUnregistered" />
> +    <!-- TODO: put the whole interface under one permission for  
> now -->
>
> -  <include file="fields.zcml" />
> -  <include package=".browser" />
> -  <include file="fieldforms.zcml" />
> +    <require
> +	permission="zope.ManageContent"
> +	interface="zope.schema.interfaces.IField"
> +	set_schema="zope.schema.interfaces.IField"
> +	/>
>
> +  </class>
> +
> +  <class class="zope.schema.Container">
> +
> +    <factory
> +        id="zope.schema.Container"
> +	title="Container Field"
> +	description="Container Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Iterable">
> +
> +    <factory
> +        id="zope.schema.Iterable"
> +	title="Iterable Field"
> +	description="Iterable Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Orderable">
> +
> +    <factory
> +        id="zope.schema.Orderable"
> +	title="Orderable Field"
> +	description="Orderable Field" />
> +
> +    <require
> +	permission="zope.ManageContent"
> +	interface="zope.schema.interfaces.IMinMax"
> +	set_schema="zope.schema.interfaces.IMinMax"
> +	/>
> +
> +  </class>
> +
> +  <class class="zope.schema.MinMaxLen">
> +
> +    <factory
> +        id="zope.schema.MinMaxLen"
> +	title="MinMaxLen Field"
> +	description="MinMaxLen Field" />
> +
> +    <require
> +	permission="zope.ManageContent"
> +	interface="zope.schema.interfaces.IMinMaxLen"
> +	set_schema="zope.schema.interfaces.IMinMaxLen"
> +	/>
> +
> +  </class>
> +
> +  <class class="zope.schema.Bytes">
> +
> +    <factory
> +	id="zope.schema.Bytes"
> +	title="Bytes Field"
> +	description="Bytes Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.BytesLine">
> +
> +    <factory
> +	id="zope.schema.BytesLine"
> +	title="BytesLine Field"
> +	description="BytesLine Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Text">
> +
> +    <factory
> +	id="zope.schema.Text"
> +	title="Text Field"
> +	description="Text Field" />
> +
> +    <implements interface="zope.schema.interfaces.IFromUnicode" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.TextLine">
> +
> +    <factory
> +	id="zope.schema.TextLine"
> +	title="Text Line Field"
> +	description="Text Line Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Bool">
> +
> +    <factory
> +	id="zope.schema.Bool"
> +	title="Boolean Field"
> +	description="Boolean Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Int">
> +
> +    <factory
> +	id="zope.schema.Int"
> +	title="Integer Field"
> +	description="Integer Field" />
> +
> +    <require like_class="zope.schema.Orderable" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Float">
> +
> +    <factory
> +	id="zope.schema.Float"
> +	title="Float Field"
> +	description="Float Field" />
> +
> +    <require like_class="zope.schema.Orderable" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Tuple">
> +
> +    <factory
> +	id="zope.schema.Tuple"
> +	title="Tuple Field"
> +	description="Tuple Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.List">
> +
> +    <factory
> +	id="zope.schema.List"
> +	title="List Field"
> +	description="List Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Choice">
> +    <factory
> +        id="zope.schema.Choice"
> +        title="Choice Field"
> +        description="Choice Field"
> +        />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Set">
> +
> +    <factory
> +	id="zope.schema.Set"
> +	title="Set Field"
> +	description="Set Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Password">
> +
> +    <factory
> +	id="zope.schema.Password"
> +	title="Password Field"
> +	description="Password Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Dict">
> +
> +    <factory
> +	id="zope.schema.Dict"
> +	title="Dict Field"
> +	description="Dict Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Datetime">
> +
> +    <factory
> +	id="zope.schema.Datetime"
> +	title="Datetime Field"
> +	description="Datetime Field" />
> +
> +    <require like_class="zope.schema.Orderable" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Date">
> +
> +    <factory
> +        id="zope.schema.Date"
> +        title="Date Field"
> +        description="Date Field"
> +        />
> +
> +    <require like_class="zope.schema.Orderable" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Timedelta">
> +
> +    <factory
> +        id="zope.schema.Timedelta"
> +        title="Timedelta Field"
> +        description="Timedelta Field"
> +        />
> +
> +    <require like_class="zope.schema.Orderable" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.SourceText">
> +
> +    <factory
> +	id="zope.schema.SourceText"
> +	title="SourceText Field"
> +	description="SourceText Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Object">
> +
> +    <factory
> +	id="zope.schema.Object"
> +	title="Object Field"
> +	description="Object Field" />
> +
> +    <require
> +       permission="zope.ManageContent"
> +       interface="zope.schema.interfaces.IObject" />
> +
> +  </class>
> +
> +  <class class="zope.schema.URI">
> +
> +    <factory
> +	id="zope.schema.URI"
> +	title="URI Field"
> +	description="URI Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.DottedName">
> +    <factory
> +        id="zope.schema.DottedName"
> +        title="Dotted Name"
> +        description="Dotted Name"
> +        />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.Id">
> +
> +    <factory
> +	id="zope.schema.Id"
> +	title="Id Field"
> +	description="Id Field" />
> +
> +    <require like_class="zope.schema.MinMaxLen" />
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.InterfaceField">
> +
> +    <factory
> +	id="zope.schema.InterfaceField"
> +	title="Interface Field"
> +	description="Interface Field" />
> +
> +    <require like_class="zope.schema.Field" />
> +
> +  </class>
> +
> +  <class class="zope.schema.vocabulary.SimpleTerm">
> +    <allow interface="zope.schema.interfaces.ITitledTokenizedTerm" />
> +  </class>
> +
> +  <class class="zope.schema.vocabulary.SimpleVocabulary">
> +    <allow interface="zope.schema.interfaces.IVocabularyTokenized" />
> +  </class>
> +
>  </configure>
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/fieldforms.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/fieldforms.zcml	 
> 2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/fieldforms.zcml	 
> 2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,163 +0,0 @@
> -<configure xmlns="http://namespaces.zope.org/zope"
> -           xmlns:browser="http://namespaces.zope.org/browser">
> -
> -  <!-- Define add and edit forms for fields as part of a (persistent)
> -       schema -->
> -
> -  <browser:addform
> -      label="Add Text Field"
> -      name="Text Field"
> -      menu="add_schema_field"
> -      title="Text Field"
> -      description="A Text Field"
> -      content_factory="zope.schema.Text"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.IText"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default min_length max_length"
> -    />
> -
> -  <browser:editform
> -      label="Edit Text Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.IText"
> -      schema="zope.schema.interfaces.IText"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default min_length max_length"
> -    />
> -
> -  <browser:addform
> -      label="Add TextLine Field"
> -      name="TextLine Field"
> -      menu="add_schema_field"
> -      title="TextLine Field"
> -      description="A TextLine Field"
> -      content_factory="zope.schema.TextLine"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.ITextLine"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default min_length max_length"
> -    />
> -
> -  <browser:editform
> -      label="Edit TextLine Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.ITextLine"
> -      schema="zope.schema.interfaces.ITextLine"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default min_length max_length"
> -    />
> -
> -  <browser:addform
> -      label="Add Boolean Field"
> -      name="Boolean Field"
> -      menu="add_schema_field"
> -      title="Boolean Field"
> -      description="A Boolean Field"
> -      content_factory="zope.schema.Bool"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.IBool"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default"
> -    />
> -
> -  <browser:editform
> -      label="Edit Boolean Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.IBool"
> -      schema="zope.schema.interfaces.IBool"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default"
> -    />
> -
> -  <browser:addform
> -      label="Add Integer Field"
> -      name="Integer Field"
> -      menu="add_schema_field"
> -      title="Integer Field"
> -      description="An Integer Field"
> -      content_factory="zope.schema.Int"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.IInt"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -  <browser:editform
> -      label="Edit Integer Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.IInt"
> -      schema="zope.schema.interfaces.IInt"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -  <browser:addform
> -      label="Add Float Field"
> -      name="Float Field"
> -      menu="add_schema_field"
> -      title="Float Field"
> -      description="A Float Field"
> -      content_factory="zope.schema.Float"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.IFloat"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -  <browser:editform
> -      label="Edit Float Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.IFloat"
> -      schema="zope.schema.interfaces.IFloat"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -  <browser:addform
> -      label="Add Datetime Field"
> -      name="Datetime Field"
> -      menu="add_schema_field"
> -      title="Datetime Field"
> -      description="A Datetime Field"
> -      content_factory="zope.schema.Datetime"
> -      for=".interfaces.ISchemaAdding"
> -      schema="zope.schema.interfaces.IDatetime"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -  <browser:editform
> -      label="Edit Datetime Field"
> -      name="edit.html"
> -      menu="zmi_views"
> -      title="Edit"
> -      for="zope.schema.interfaces.IDatetime"
> -      schema="zope.schema.interfaces.IDatetime"
> -      permission="zope.ManageContent"
> -      fields="title description required readonly
> -              default max min"
> -    />
> -
> -</configure>
> \ No newline at end of file
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/fields.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/fields.zcml	2006-07-19  
> 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/fields.zcml	2006-07-19  
> 15:43:42 UTC (rev 69202)
> @@ -1,359 +0,0 @@
> -<configure xmlns="http://namespaces.zope.org/zope">
> -
> -  <class class="zope.schema.Field">
> -
> -    <factory
> -        id="zope.schema.Field"
> -	title="Basic Field"
> -	description="Basic Field" />
> -
> -    <implements interface="zope.interface.interfaces.IAttribute" />
> -
> -    <!--
> -    <require
> -	permission="zope.View"
> -	interface="zope.schema.interfaces.IField"
> -	/>
> -
> -    <require
> -	permission="zope.ManageContent"
> -	attributes="bind set"
> -	/>
> -    -->
> -
> -    <allow attributes="__name__" />
> -
> -    <!-- TODO: put the whole interface under one permission for  
> now -->
> -
> -    <require
> -	permission="zope.ManageContent"
> -	interface="zope.schema.interfaces.IField"
> -	set_schema="zope.schema.interfaces.IField"
> -	/>
> -
> -  </class>
> -
> -  <class class="zope.schema.Container">
> -
> -    <factory
> -        id="zope.schema.Container"
> -	title="Container Field"
> -	description="Container Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Iterable">
> -
> -    <factory
> -        id="zope.schema.Iterable"
> -	title="Iterable Field"
> -	description="Iterable Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Orderable">
> -
> -    <factory
> -        id="zope.schema.Orderable"
> -	title="Orderable Field"
> -	description="Orderable Field" />
> -
> -    <require
> -	permission="zope.ManageContent"
> -	interface="zope.schema.interfaces.IMinMax"
> -	set_schema="zope.schema.interfaces.IMinMax"
> -	/>
> -
> -  </class>
> -
> -  <class class="zope.schema.MinMaxLen">
> -
> -    <factory
> -        id="zope.schema.MinMaxLen"
> -	title="MinMaxLen Field"
> -	description="MinMaxLen Field" />
> -
> -    <require
> -	permission="zope.ManageContent"
> -	interface="zope.schema.interfaces.IMinMaxLen"
> -	set_schema="zope.schema.interfaces.IMinMaxLen"
> -	/>
> -
> -  </class>
> -
> -  <class class="zope.schema.Bytes">
> -
> -    <factory
> -	id="zope.schema.Bytes"
> -	title="Bytes Field"
> -	description="Bytes Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.BytesLine">
> -
> -    <factory
> -	id="zope.schema.BytesLine"
> -	title="BytesLine Field"
> -	description="BytesLine Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Text">
> -
> -    <factory
> -	id="zope.schema.Text"
> -	title="Text Field"
> -	description="Text Field" />
> -
> -    <implements interface="zope.schema.interfaces.IFromUnicode" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.TextLine">
> -
> -    <factory
> -	id="zope.schema.TextLine"
> -	title="Text Line Field"
> -	description="Text Line Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Bool">
> -
> -    <factory
> -	id="zope.schema.Bool"
> -	title="Boolean Field"
> -	description="Boolean Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Int">
> -
> -    <factory
> -	id="zope.schema.Int"
> -	title="Integer Field"
> -	description="Integer Field" />
> -
> -    <require like_class="zope.schema.Orderable" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Float">
> -
> -    <factory
> -	id="zope.schema.Float"
> -	title="Float Field"
> -	description="Float Field" />
> -
> -    <require like_class="zope.schema.Orderable" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Tuple">
> -
> -    <factory
> -	id="zope.schema.Tuple"
> -	title="Tuple Field"
> -	description="Tuple Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.List">
> -
> -    <factory
> -	id="zope.schema.List"
> -	title="List Field"
> -	description="List Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Choice">
> -    <factory
> -        id="zope.schema.Choice"
> -        title="Choice Field"
> -        description="Choice Field"
> -        />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Set">
> -
> -    <factory
> -	id="zope.schema.Set"
> -	title="Set Field"
> -	description="Set Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Password">
> -
> -    <factory
> -	id="zope.schema.Password"
> -	title="Password Field"
> -	description="Password Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Dict">
> -
> -    <factory
> -	id="zope.schema.Dict"
> -	title="Dict Field"
> -	description="Dict Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Datetime">
> -
> -    <factory
> -	id="zope.schema.Datetime"
> -	title="Datetime Field"
> -	description="Datetime Field" />
> -
> -    <require like_class="zope.schema.Orderable" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Date">
> -
> -    <factory
> -        id="zope.schema.Date"
> -        title="Date Field"
> -        description="Date Field"
> -        />
> -
> -    <require like_class="zope.schema.Orderable" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Timedelta">
> -
> -    <factory
> -        id="zope.schema.Timedelta"
> -        title="Timedelta Field"
> -        description="Timedelta Field"
> -        />
> -
> -    <require like_class="zope.schema.Orderable" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.SourceText">
> -
> -    <factory
> -	id="zope.schema.SourceText"
> -	title="SourceText Field"
> -	description="SourceText Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Object">
> -
> -    <factory
> -	id="zope.schema.Object"
> -	title="Object Field"
> -	description="Object Field" />
> -
> -    <require
> -       permission="zope.ManageContent"
> -       interface="zope.schema.interfaces.IObject" />
> -
> -  </class>
> -
> -  <class class="zope.schema.URI">
> -
> -    <factory
> -	id="zope.schema.URI"
> -	title="URI Field"
> -	description="URI Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.DottedName">
> -    <factory
> -        id="zope.schema.DottedName"
> -        title="Dotted Name"
> -        description="Dotted Name"
> -        />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.Id">
> -
> -    <factory
> -	id="zope.schema.Id"
> -	title="Id Field"
> -	description="Id Field" />
> -
> -    <require like_class="zope.schema.MinMaxLen" />
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.InterfaceField">
> -
> -    <factory
> -	id="zope.schema.InterfaceField"
> -	title="Interface Field"
> -	description="Interface Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.vocabulary.SimpleTerm">
> -    <allow interface="zope.schema.interfaces.ITitledTokenizedTerm" />
> -  </class>
> -
> -  <class class="zope.schema.vocabulary.SimpleVocabulary">
> -    <allow interface="zope.schema.interfaces.IVocabularyTokenized" />
> -  </class>
> -
> -</configure>
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/interfaces.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/interfaces.py	2006-07-19  
> 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/interfaces.py	2006-07-19  
> 15:43:42 UTC (rev 69202)
> @@ -1,90 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2003 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""TTW Schema Interfaces
> -
> -$Id$
> -"""
> -from zope.interface import Interface
> -from zope.interface.interfaces import IInterface
> -from zope.app.container.interfaces import IAdding
> -
> -class ISchemaUtility(Interface):
> -    pass
> -
> -class ISchemaAdding(IAdding):
> -    pass
> -
> -class IReadMutableSchema(IInterface):
> -    """This object represents an interface/schema that can be  
> edited by
> -    managing the fields it contains."""
> -
> -    def getName(name):
> -        """Get the name of the schema."""
> -
> -class IWriteMutableSchema(Interface):
> -    """This object represents an interface/schema that can be  
> edited by
> -    managing the fields it contains."""
> -
> -    def setName(name):
> -        """Set the name of the schema."""
> -
> -    def addField(name, field):
> -        """Add a field to schema."""
> -
> -    def removeField(name):
> -        """Remove field by name from the schema.
> -
> -        If the field does not exist, raise an error.
> -        """
> -
> -    def renameField(orig_name, target_name):
> -        """Rename a field.
> -
> -        If the target_name is already taken, raise an error.
> -        """
> -
> -    def insertField(name, field, position):
> -        """Insert a field with a given name at the specified  
> position.
> -
> -        If the position does not make sense, i.e. a negative  
> number of a
> -        number larger than len(self), then an error is raised.
> -        """
> -
> -    def moveField(name, position):
> -        """Move a field (given by its name) to a particular position.
> -
> -        If the position does not make sense, i.e. a negative  
> number of a
> -        number larger than len(self), then an error is raised.
> -        """
> -
> -    def moveField(name, position):
> -        """Move a field (given by its name) to a particular position.
> -
> -        If the position does not make sense, i.e. a negative  
> number of a
> -        number larger than len(self), then an error is raised.
> -        """
> -
> -    def __setitem__(name, object):
> -        """Add the given object to the container under the given  
> name.
> -        """
> -
> -    def __delitem__(name):
> -        """Delete the named object from the container.
> -
> -        Raises a KeyError if the object is not found.
> -        """
> -
> -class IMutableSchema(IReadMutableSchema, IWriteMutableSchema):
> -    """This object represents an interface/schema that can be  
> edited by
> -    managing the fields it contains."""
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/schema.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/schema.py	2006-07-19  
> 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/schema.py	2006-07-19  
> 15:43:42 UTC (rev 69202)
> @@ -1,286 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2003 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""TTW Schema (as Utility)
> -
> -$Id$
> -"""
> -from types import FunctionType
> -
> -from persistent import Persistent
> -from persistent.dict import PersistentDict
> -from zope.interface import Interface, implements
> -import zope.component.interfaces
> -
> -from zope.security.proxy import removeSecurityProxy
> -from zope.proxy import removeAllProxies
> -from zope.app import zapi
> -from zope.app.container.browser.adding import Adding
> -from zope.app.interface import PersistentInterfaceClass
> -from zope.app.container.contained import Contained, setitem,  
> uncontained
> -
> -from zope.interface.interface import Attribute, Method, fromFunction
> -from zope.interface.interface import InterfaceClass
> -from zope.interface.exceptions import InvalidInterface
> -from zope.schema import getFieldsInOrder, getFieldNamesInOrder
> -
> -from wrapper import Struct
> -from interfaces import ISchemaAdding, IMutableSchema, ISchemaUtility
> -
> -class BaseSchemaUtility(InterfaceClass):
> -
> -    implements(IMutableSchema, ISchemaUtility)
> -
> -    def __init__(self, name='', bases=(), attrs=None,
> -                 __doc__=None, __module__=None):
> -        if not bases:
> -            bases = (Interface,)
> -        super(BaseSchemaUtility, self).__init__(name, bases,
> -                                            attrs, __doc__,  
> __module__)
> -        self._clear()
> -
> -    def _clear(self):
> -        self.schemaPermissions = {}
> -        self._attrs = {}
> -
> -    def setName(self, name):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        self.__name__ = name
> -
> -    def addField(self, name, field):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        fields = getFieldsInOrder(self)
> -        field_names = [n for n, f in fields]
> -        fields = [f for n, f in fields]
> -        if name in field_names:
> -            raise KeyError("Field %s already exists." % name)
> -        if fields:
> -            field.order = fields[-1].order + 1
> -        self[name] = field
> -
> -    def removeField(self, name):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        fields = getFieldNamesInOrder(self)
> -        if name not in fields:
> -            raise KeyError("Field %s does not exists." % name)
> -        del self[name]
> -
> -    def renameField(self, orig_name, target_name):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        fields = getFieldNamesInOrder(self)
> -        if orig_name not in fields:
> -            raise KeyError("Field %s does not exists." % orig_name)
> -        if target_name in fields:
> -            raise KeyError("Field %s already exists." % target_name)
> -        field = self[orig_name]
> -        del self[orig_name]
> -        field.__name__ = None
> -        self[target_name] = field
> -
> -    def insertField(self, name, field, position):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        fields = getFieldsInOrder(self)
> -        field_names = [n for n, f in fields]
> -        fields = [f for n, f in fields]
> -        if name in field_names:
> -            raise KeyError("Field %s already exists." % name)
> -        if not 0 <= position <= len(field_names):
> -            raise IndexError("Position %s out of range." % position)
> -        fields.insert(position, field)
> -        for p, f in enumerate(fields):
> -            if not f.order == p:
> -                f.order = p
> -        self[name] = field
> -
> -    def moveField(self, name, position):
> -        """See zope.app.interfaces.utilities.IMutableSchema"""
> -        fields = getFieldsInOrder(self)
> -        field_names = [n for n, f in fields]
> -        fields = [f for n, f in fields]
> -        if name not in field_names:
> -            raise KeyError("Field %s does not exist." % name)
> -        if not 0 <= position <= len(field_names):
> -            raise IndexError("Position %s out of range." % position)
> -        index = field_names.index(name)
> -        if index == position: return
> -        field = fields[index]
> -        del fields[index]
> -        fields.insert(position, field)
> -        for p, f in enumerate(fields):
> -            if not f.order == p:
> -                f.order = p
> -
> -    def __delitem__(self, name):
> -        uncontained(self._attrs[name], self, name)
> -        del self._attrs[name]
> -
> -    def __setitem__(self, name, value):
> -        value = removeAllProxies(value)
> -        if isinstance(value, Attribute):
> -            value.interface = name
> -            if not value.__name__:
> -                value.__name__ = name
> -            elif isinstance(value, FunctionType):
> -                attrs[name] = fromFunction(value, name, name=name)
> -            else:
> -                raise InvalidInterface("Concrete attribute, %s" %  
> name)
> -
> -        setitem(self, self._attrs.__setitem__, name, value)
> -
> -    # Methods copied from zope.interface.interface.InterfaceClass,
> -    # to avoid having to work around name mangling, which happens  
> to be
> -    # ugly and undesirable.
> -    # Copied some methods, but not all. Only the ones that used  
> __attrs
> -    # and __bases__. Changed __attrs to _attrs, which is a  
> PersistentDict,
> -    # and __bases__ to getBases(), whic filters instances of  
> InterfaceClass
> -    def getBases(self):
> -        return [b for b in self.__bases__ if isinstance(b,  
> self.__class__)]
> -
> -    def extends(self, interface, strict=True):
> -        """Does an interface extend another?"""
> -        return ((interface in self._implied)
> -                and
> -                ((not strict) or (self != interface))
> -                )
> -
> -    def names(self, all=False):
> -        """Return the attribute names defined by the interface."""
> -        if not all:
> -            return self._attrs.keys()
> -
> -        r = {}
> -        for name in self._attrs.keys():
> -            r[name] = 1
> -        for base in self.getBases():
> -            for name in base.names(all):
> -                r[name] = 1
> -        return r.keys()
> -
> -    def namesAndDescriptions(self, all=False):
> -        """Return attribute names and descriptions defined by  
> interface."""
> -        if not all:
> -            return self._attrs.items()
> -
> -        r = {}
> -        for name, d in self._attrs.items():
> -            r[name] = d
> -
> -        for base in self.getBases():
> -            for name, d in base.namesAndDescriptions(all):
> -                if name not in r:
> -                    r[name] = d
> -
> -        return r.items()
> -
> -    def getDescriptionFor(self, name):
> -        """Return the attribute description for the given name."""
> -        r = self.queryDescriptionFor(name)
> -        if r is not None:
> -            return r
> -
> -        raise KeyError(name)
> -
> -    __getitem__ = getDescriptionFor
> -
> -    def queryDescriptionFor(self, name, default=None):
> -        """Return the attribute description for the given name."""
> -        r = self._attrs.get(name, self)
> -        if r is not self:
> -            return r
> -        for base in self.getBases():
> -            r = base.queryDescriptionFor(name, self)
> -            if r is not self:
> -                return r
> -
> -        return default
> -
> -    get = queryDescriptionFor
> -
> -    def deferred(self):
> -        """Return a defered class corresponding to the interface."""
> -        if hasattr(self, "_deferred"): return self._deferred
> -
> -        klass={}
> -        exec "class %s: pass" % self.__name__ in klass
> -        klass=klass[self.__name__]
> -
> -        self.__d(klass.__dict__)
> -
> -        self._deferred=klass
> -
> -        return klass
> -
> -    def __d(self, dict):
> -
> -        for k, v in self._attrs.items():
> -            if isinstance(v, Method) and not (k in dict):
> -                dict[k]=v
> -
> -        for b in self.getBases(): b.__d(dict)
> -
> -
> -class StructPersistentDict(PersistentDict):
> -
> -    def __setitem__(self, name, value):
> -        if not isinstance(value, Persistent):
> -            value = Struct(value)
> -        return super(StructPersistentDict, self).__setitem__(name,  
> value)
> -
> -
> -class SchemaUtility(BaseSchemaUtility, PersistentInterfaceClass,  
> Contained):
> -
> -    def __init__(self, name='', bases=(), attrs=None,
> -                 __doc__=None, __module__=None):
> -        if not bases:
> -            bases = (Interface,)
> -        PersistentInterfaceClass.__init__(self, name, bases,
> -                                          attrs, __doc__, __module__)
> -        self._clear()
> -
> -    def _clear(self):
> -        self.schemaPermissions = PersistentDict()
> -        self._attrs = StructPersistentDict()
> -
> -
> -class SchemaAdding(Adding):
> -
> -    implements(ISchemaAdding)
> -
> -    menu_id = "add_schema_field"
> -
> -    def add(self, content):
> -        name = self.contentName
> -        container = IMutableSchema(self.context)
> -        container.addField(name, content)
> -        return content
> -
> -    def nextURL(self):
> -        """See zope.app.container.interfaces.IAdding"""
> -        return zapi.absoluteURL(self.context,
> -                                self.request,
> -                                )+'/@@editschema.html'
> -
> -
> - at zope.component.adapter(
> -    ISchemaUtility,
> -    zope.component.interfaces.IRegistered,
> -    )
> -def schemaUtilityRegistered(schema, event):
> -    schema.setName(event.object.name)
> -
> - at zope.component.adapter(
> -    ISchemaUtility,
> -    zope.component.interfaces.IUnregistered,
> -    )
> -def schemaUtilityUnregistered(schema, event):
> -    schema.setName('<schema not activated>')
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/fields.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/fields.zcml	 
> 2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/fields.zcml	 
> 2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,15 +0,0 @@
> -<configure
> -    xmlns="http://namespaces.zope.org/zope"
> -    i18n_domain="zope">
> -
> -    <include package="zope.app.schema" file="meta.zcml" />
> -    <include package="zope.app.component" file="meta.zcml" />
> -    <include package="zope.app.publisher" file="meta.zcml" />
> -    <include package="zope.app.form.browser" file="meta.zcml" />
> -    <include package="zope.app.security" file="meta.zcml"/>
> -    <include package="zope.app.security" file="configure.zcml"/>
> -    <include package="zope.app.component.browser" file="meta.zcml" />
> -    <include package="zope.app" file="menus.zcml" />
> -    <include package="zope.app.schema" file="configure.zcml" />
> -
> -</configure>
> \ No newline at end of file
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/test_field.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/test_field.py	 
> 2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/test_field.py	 
> 2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,78 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Field Tests
> -
> -$Id$
> -"""
> -import unittest
> -
> -from persistent.tests.persistenttestbase import DM
> -
> -from zope.configuration import xmlconfig
> -from zope.schema import Text, getFieldsInOrder
> -from zope.security.checker import ProxyFactory
> -from zope.security.management import system_user, newInteraction
> -from zope.app.testing import setup
> -from zope.app.schema.wrapper import Struct
> -from zope.security.checker import getChecker, _defaultChecker
> -import zope.app.schema.tests
> -
> -
> -class ParticipationStub(object):
> -
> -    def __init__(self, principal):
> -        self.principal = principal
> -        self.interaction = None
> -
> -
> -class FieldPersistence(unittest.TestCase):
> -
> -    def test_field_change(self):
> -        f = Text(title=u'alpha')
> -        f = Struct(f)
> -        f._p_oid = '\0\0\0\0\0\0hi'
> -        dm = DM()
> -        f._p_jar = dm
> -        self.assertEqual(f._p_changed, 0)
> -        f.title = u'bar'
> -        self.assertEqual(f._p_changed, 1)
> -        self.assertEqual(dm.called, 1)
> -
> -class FieldPermissions(unittest.TestCase):
> -
> -    def setUp(self):
> -        setup.placefulSetUp()
> -        self.context = xmlconfig.file("fields.zcml",  
> zope.app.schema.tests)
> -
> -    def test_wrapped_field_checker(self):
> -        f1 = Text(title=u'alpha')
> -        f1 = ProxyFactory(f1)
> -        f2 = Text(title=u'alpha')
> -        f2 = Struct(f2)
> -        f2 = ProxyFactory(f2)
> -        self.assertEquals(getChecker(f1), getChecker(f2))
> -        self.failIf(getChecker(f1) is _defaultChecker)
> -        self.failIf(getChecker(f2) is _defaultChecker)
> -
> -    def tearDown(self):
> -        setup.placefulTearDown()
> -
> -def test_suite():
> -    return unittest.TestSuite((
> -        unittest.makeSuite(FieldPersistence),
> -        unittest.makeSuite(FieldPermissions),
> -        ))
> -
> -if __name__ == '__main__':
> -    unittest.main()
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.py	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.py	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,72 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Field Factory Tests
> -
> -$Id$
> -"""
> -import unittest
> -
> -import zope.app.schema
> -
> -from zope.app import zapi
> -from zope.component.interfaces import ComponentLookupError, IFactory
> -from zope.app.testing.placelesssetup import PlacelessSetup
> -from zope.schema.interfaces import IField, IText
> -from zope.interface import Interface
> -from zope.configuration import xmlconfig
> -
> -
> -class ParticipationStub(object):
> -
> -    def __init__(self, principal):
> -        self.principal = principal
> -        self.interaction = None
> -
> -class IFoo(Interface): pass
> -
> -class TestFieldFactory(PlacelessSetup, unittest.TestCase):
> -
> -    def setUp(self):
> -        super(TestFieldFactory, self).setUp()
> -        context = xmlconfig.file('tests/test_fieldfactory.zcml',
> -                                 zope.app.schema)
> -
> -    def testRegisterFields(self):
> -        factory = zapi.getUtility(IFactory,
> -                                   
> 'zope.schema._bootstrapfields.Text')
> -        self.assertEquals(factory.title, "Text Field")
> -        self.assertEquals(factory.description, "Text Field")
> -
> -    def testGetFactoriesForIField(self):
> -        factories = list(zapi.getFactoriesFor(IField))
> -        self.assertEqual(len(factories), 3)
> -
> -    def testGetFactoriesForIText(self):
> -        factories = list(zapi.getFactoriesFor(IText))
> -        self.assertEqual(len(factories), 2)
> -
> -    def testGetFactoriesUnregistered(self):
> -        factories = list(zapi.getFactoriesFor(IFoo))
> -        self.assertEqual(len(factories), 0)
> -
> -
> -def test_suite():
> -    suite = unittest.TestSuite()
> -    loader = unittest.TestLoader()
> -    suite.addTest(loader.loadTestsFromTestCase(TestFieldFactory))
> -    return suite
> -
> -
> -if __name__=='__main__':
> -    unittest.TextTestRunner().run(test_suite())
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.zcml	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_fieldfactory.zcml	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,56 +0,0 @@
> -<configure xmlns="http://namespaces.zope.org/zope"
> -           i18n_domain="zope">
> -
> -  <include package="zope.app.schema" file="meta.zcml" />
> -  <include package="zope.app.component" file="meta.zcml" />
> -  <include package="zope.app.publisher" file="meta.zcml" />
> -  <include package="zope.app.security" file="meta.zcml" />
> -  <include package="zope.app.security" file="configure.zcml" />
> -
> -  <class class="zope.schema.Field">
> -
> -    <factory
> -	title="Basic Field"
> -	description="Basic Field" />
> -
> -    <!--
> -    <require
> -	permission="zope.View"
> -	interface="zope.schema.interfaces.IField"
> -	/>
> -
> -    <require
> -	permission="zope.ManageContent"
> -	attributes="bind set"
> -	/>
> -    -->
> -
> -    <!-- TODO: put the whole interface under one permission for  
> now -->
> -    <require
> -	permission="zope.ManageContent"
> -	interface="zope.schema.interfaces.IField"
> -	/>
> -
> -  </class>
> -
> -  <class class="zope.schema.Text">
> -
> -    <factory
> -	title="Text Field"
> -	description="Text Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -  <class class="zope.schema.TextLine">
> -
> -    <factory
> -	title="Text Line Field"
> -	description="Text Line Field" />
> -
> -    <require like_class="zope.schema.Field" />
> -
> -  </class>
> -
> -</configure>
> \ No newline at end of file
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_interfaceutility.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_interfaceutility.py	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_interfaceutility.py	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,196 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2003 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Interfaces as Utilities tests
> -
> -$Id$
> -"""
> -import unittest
> -import zope.component
> -from zope.interface import Interface, implements
> -from zope.interface.interface import InterfaceClass
> -from zope.interface.interfaces import IInterface
> -from zope.component.interfaces import ComponentLookupError
> -from zope.component.interface import getInterface, searchInterface
> -from zope.traversing.api import traverse
> -
> -from zope.app.component.testing import PlacefulSetup
> -from zope.app.container.contained import Contained
> -from zope.app.dependable.interfaces import IDependable
> -from zope.app.testing import setup
> -
> -class IBaz(Interface): pass
> -
> -class Baz(object):
> -    # We implement IDependable directly to
> -    # depend as little  as possible on other infrastructure.
> -    implements(IBaz, IDependable)
> -
> -    def __init__(self, name):
> -        self.name = name
> -        self._dependents = []
> -
> -    def foo(self):
> -        return 'foo ' + self.name
> -
> -    def addDependent(self, location):
> -        "See zope.app.dependable.interfaces.IDependable"
> -        if location not in self._dependents:
> -            self._dependents.append(location)
> -
> -    def removeDependent(self, location):
> -        "See zope.app.dependable.interfaces.IDependable"
> -        self._dependents.remove(location)
> -
> -    def dependents(self):
> -        "See zope.app.dependable.interfaces.IDependable"
> -        return self._dependents
> -
> -class Foo(InterfaceClass, Baz, Contained):
> -
> -    def __init__(self, name):
> -        InterfaceClass.__init__(self, name, (Interface,))
> -        Baz.__init__(self, name)
> -
> -class Bar(Foo): pass
> -
> -class TestInterfaceUtility(PlacefulSetup, unittest.TestCase):
> -
> -    def setUp(self):
> -        sm = PlacefulSetup.setUp(self, site=True)
> -
> -    def test_getLocalInterface_delegates_to_globalUtility(self):
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(Bar("blob"), IInterface, name="blob")
> -        gsm.registerUtility(Baz("global baz"), IBaz)
> -        gsm.registerUtility(Foo("global bob"), IInterface,  
> name="bob")
> -
> -        self.assertEqual(getInterface(None, "bob").__class__, Foo)
> -        self.assertEqual(getInterface(None, "blob").__class__, Bar)
> -
> -    def test_localInterfaceitems_filters_accordingly(self):
> -        bar = Bar("global")
> -        baz = Baz("global baz")
> -        foo = Foo("global bob")
> -
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(foo, IInterface, name="bob")
> -        gsm.registerUtility(bar, IInterface)
> -        gsm.registerUtility(baz, IBaz)
> -
> -        ifaces = searchInterface(None)
> -        self.assert_(len(ifaces), 2)
> -        for pair in [(foo), (bar)]:
> -            self.assert_(pair in ifaces)
> -
> -        iface_utilities = gsm.getUtilitiesFor(IInterface)
> -        ifaces = [iface for (name, iface) in iface_utilities]
> -
> -        self.assert_(len(ifaces), 2)
> -        for pair in [(foo), (bar)]:
> -            self.assert_(pair in ifaces)
> -
> -        for pair in [(foo), (bar)]:
> -            self.assert_(pair in ifaces)
> -
> -    def test_localInterfaceitems_filters_only_interfaces(self):
> -        bar = Bar("global")
> -        baz = Baz("global baz")
> -        foo = Foo("global bob")
> -        gsm = zope.component.getGlobalSiteManager()
> -
> -        gsm.registerUtility(foo, IInterface, name="bob")
> -        gsm.registerUtility(baz, IBaz)
> -
> -        iface_utilities = gsm.getUtilitiesFor(IInterface)
> -        ifaces = [iface for (name, iface) in iface_utilities]
> -        self.assertEqual(ifaces, [(foo)])
> -
> -        iface_utilities = gsm.getUtilitiesFor(IBaz)
> -        ifaces = [iface for (name, iface) in iface_utilities]
> -        self.assertEqual(ifaces, [(baz)])
> -
> -    def test_getLocalInterface_raisesComponentLookupError(self):
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(Foo("global"), Interface)
> -        gsm.registerUtility(Baz("global baz"), IBaz)
> -        gsm.registerUtility(Foo("global bob"), IInterface,  
> name="bob")
> -
> -        self.assertRaises(ComponentLookupError,
> -                          getInterface, None, "bobesponja")
> -
> -    def test_globalsearchInterface_delegates_to_globalUtility(self):
> -        foo = Foo("global bob")
> -        bar = Bar("global")
> -        baz = Baz("global baz")
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(foo, IInterface, name="bob")
> -        gsm.registerUtility(bar, IInterface)
> -        gsm.registerUtility(baz, IBaz)
> -
> -        self.assertEqual(searchInterface(None, search_string="bob"),
> -                         [foo])
> -
> -    def test_localsearchInterface_delegates_to_globalUtility(self):
> -        # Same test as above!
> -        foo = Foo("global bob")
> -        bar = Bar("global")
> -        baz = Baz("global baz")
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(foo, IInterface, name="bob")
> -        gsm.registerUtility(bar, IInterface)
> -        gsm.registerUtility(baz, IBaz)
> -
> -        self.assertEqual(searchInterface(None, search_string="bob"),
> -                         [foo])
> -
> -    def test_query_get_Utility_delegates_to_global(self):
> -        zope.component.provideUtility(Foo("global"), IInterface)
> -        zope.component.provideUtility(Foo("global bob"), IInterface,
> -                                      name="bob")
> -
> -        gsm = zope.component.getGlobalSiteManager()
> -        sm = zope.component.getSiteManager(self.rootFolder)
> -        self.assert_(gsm != sm)
> -
> -        # If queryUtility works on the site manager, getUtility in  
> zapi must
> -        # also work.
> -        self.assertEqual(sm.queryUtility(IInterface).foo(), "foo  
> global")
> -        self.assertEqual(sm.queryUtility(IInterface, "bob").foo(),
> -                         "foo global bob")
> -
> -    def test_local_utilities(self):
> -        gsm = zope.component.getGlobalSiteManager()
> -        gsm.registerUtility(Foo("global"), IInterface)
> -        gsm.registerUtility(Foo("global bob"), IInterface,  
> name="bob")
> -
> -        sm = zope.component.getSiteManager(self.rootFolder)
> -        default = traverse(self.rootFolder, "++etc++site/default")
> -        default['foo'] = Foo("local")
> -        foo = default['foo']
> -
> -        for name in ('', 'bob'):
> -            gout = name and "foo global "+name or "foo global"
> -            self.assertEqual(sm.queryUtility(IInterface, name).foo 
> (), gout)
> -            sm.registerUtility(foo, IInterface, name)
> -            self.assertEqual(
> -                sm.queryUtility(IInterface, name).foo(), "foo local")
> -            sm.unregisterUtility(foo, IInterface, name)
> -            self.assertEqual(sm.queryUtility(IInterface, name).foo 
> (), gout)
> -
> -
> -def test_suite():
> -    return unittest.makeSuite(TestInterfaceUtility)
> -
> -if __name__ == '__main__':
> -    unittest.main()
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautility.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautility.py	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautility.py	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,209 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2002 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Test Persistent Schemas
> -
> -$Id$
> -"""
> -from unittest import TestCase, makeSuite, TestSuite
> -
> -from zope.configuration import xmlconfig
> -from zope.schema import Text, getFieldNamesInOrder, getFieldsInOrder
> -from zope.security.checker import getChecker, _defaultChecker,  
> ProxyFactory
> -from zope.app.schema.schema import SchemaUtility
> -from zope.app.testing import setup
> -from zope.app import zapi
> -import zope.app.schema.tests
> -
> -class ParticipationStub(object):
> -
> -    def __init__(self, principal):
> -        self.principal = principal
> -        self.interaction = None
> -
> -
> -class SchemaUtilityTests(TestCase):
> -
> -    def _createSchemaUtility(self):
> -        return SchemaUtility()
> -
> -    def _additionalSetup(self):
> -        self.s = self._createSchemaUtility()
> -        self.s.setName('IFoo')
> -        self.alpha = Text(title=u"alpha")
> -
> -    def setUp(self):
> -        setup.placefulSetUp()
> -        self._additionalSetup()
> -
> -    def test_addField(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        self.assertEquals(
> -            [u'alpha',],
> -            getFieldNamesInOrder(s))
> -
> -    def test_addFieldInsertsAtEnd(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        s.addField(u'beta', beta)
> -        self.assertEquals(
> -            [u'alpha', u'beta'],
> -            getFieldNamesInOrder(s))
> -
> -    def test_removeField(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        s.removeField(u'alpha')
> -        self.assertEquals(
> -            [],
> -            getFieldNamesInOrder(s))
> -
> -    def test_addFieldCollision(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        self.assertRaises(KeyError, s.addField, 'alpha', self.alpha)
> -
> -    def test_removeFieldNotPresent(self):
> -        self.assertRaises(KeyError, self.s.removeField, 'alpha')
> -
> -    def test_renameField(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        s.renameField(u'alpha', 'beta')
> -        self.assertEquals(
> -            [u'beta'],
> -            getFieldNamesInOrder(s))
> -
> -    def test_renameFieldCollision(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        s.addField(u'beta', Text(title=u"Beta"))
> -        self.assertRaises(KeyError, s.renameField, 'alpha', 'beta')
> -
> -    def test_renameFieldNotPresent(self):
> -        self.assertRaises(KeyError, self.s.renameField, 'alpha',  
> 'beta')
> -
> -    def test_insertField(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        s.insertField(u'beta', beta, 0)
> -        self.assertEquals(
> -            [u'beta', u'alpha'],
> -            getFieldNamesInOrder(s))
> -
> -    def test_insertFieldCollision(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        self.assertRaises(KeyError, s.insertField, 'alpha', beta, 0)
> -
> -    def test_insertFieldCornerCases(self):
> -        s = self.s
> -        gamma = Text(title=u"Gamma")
> -        # it's still possible to insert at beginning
> -        s.insertField(u'gamma', gamma, 0)
> -        self.assertEquals(
> -            [u'gamma'],
> -            getFieldNamesInOrder(s))
> -        # should be allowed to insert field at the end
> -        s.insertField(u'alpha', self.alpha, 1)
> -        self.assertEquals(
> -            [u'gamma', u'alpha'],
> -            getFieldNamesInOrder(s))
> -        # should be allowed to insert field at the beginning still
> -        delta = Text(title=u"Delta")
> -        s.insertField(u'delta', delta, 0)
> -        self.assertEquals(
> -            [u'delta', u'gamma', u'alpha'],
> -            getFieldNamesInOrder(s))
> -
> -    def test_insertFieldBeyondEnd(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        self.assertRaises(IndexError, s.insertField,
> -                          'beta', beta, 100)
> -
> -    def test_insertFieldBeforeBeginning(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        self.assertRaises(IndexError, s.insertField,
> -                          'beta', beta, -1)
> -
> -    def test_moveField(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u'Beta')
> -        s.addField(u'beta', beta)
> -        gamma = Text(title=u'Gamma')
> -        s.addField(u'gamma', gamma)
> -        s.moveField(u'beta', 3)
> -        self.assertEquals(
> -            [u'alpha', u'gamma', u'beta'],
> -            getFieldNamesInOrder(s))
> -        s.moveField(u'beta', 2)
> -        self.assertEquals(
> -            [u'alpha', u'gamma', u'beta'],
> -            getFieldNamesInOrder(s))
> -        s.moveField(u'beta', 1)
> -        self.assertEquals(
> -            [u'alpha', u'beta', u'gamma'],
> -            getFieldNamesInOrder(s))
> -        s.moveField(u'beta', 0)
> -        self.assertEquals(
> -            [u'beta', u'alpha', u'gamma'],
> -            getFieldNamesInOrder(s))
> -
> -    def test_moveFieldBeyondEnd(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        s.addField(u'beta', beta)
> -        self.assertRaises(IndexError, s.moveField,
> -                          'beta', 100)
> -
> -    def test_moveFieldBeforeBeginning(self):
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        beta = Text(title=u"Beta")
> -        s.addField(u'beta', beta)
> -        self.assertRaises(IndexError, s.moveField,
> -                          'beta', -1)
> -
> -    def test_traverseToField(self):
> -        context = xmlconfig.file("fields.zcml",  
> zope.app.schema.tests)
> -        s = self.s
> -        s.addField(u'alpha', self.alpha)
> -        s = ProxyFactory(s)
> -        f1 = ProxyFactory(s[u'alpha'])
> -        order = f1.order
> -        f1 = zapi.traverse(s, 'alpha')
> -        self.assertEquals(f1.order, self.alpha.order)
> -        title = zapi.traverse(f1, 'title')
> -        self.assertEquals(title, self.alpha.title)
> -        fields = getFieldsInOrder(s)
> -        for k, v in fields:
> -            self.failUnless(v.title is not None)
> -
> -    def tearDown(self):
> -        setup.placefulTearDown()
> -
> -
> -def test_suite():
> -    return TestSuite((
> -        makeSuite(SchemaUtilityTests),
> -         ))
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautilitypersistence.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautilitypersistence.py	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/ 
> test_schemautilitypersistence.py	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,107 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2003 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Tests for Schema Utility Persistence
> -
> -$Id$
> -"""
> -import unittest
> -
> -from persistent.tests.persistenttestbase import PersistentTest, DM
> -from zope.app.schema.wrapper import Struct
> -from zope.app.schema.schema import SchemaUtility
> -from zope.schema import Text, getFieldsInOrder
> -from zope.app.testing import setup
> -
> -class PSchema(SchemaUtility):
> -
> -    def __init__(self):
> -        super(PSchema, self).__init__()
> -        self.x = 0
> -        self.setName('PSchema')
> -
> -    def inc(self):
> -        self.x += 1
> -
> -class PersistentSchemaUtilityTest(PersistentTest):
> -
> -    klass = PSchema
> -
> -    def setUp(self):
> -        PersistentTest.setUp(self)
> -        setup.placefulSetUp(self)
> -
> -    def testState(self):
> -        pass
> -
> -#     def testChangeField(self):
> -#         f = Text(title=u'alpha')
> -#         p = self.klass()
> -#         p._p_oid = '\0\0\0\0\0\0hi'
> -#         dm = DM()
> -#         p._p_jar = dm
> -#         self.assertEqual(p._p_changed, 0)
> -#         self.assertEqual(dm.called, 0)
> -#         p.addField('alpha', f)
> -#         self.assertEqual(p._p_changed, 1)
> -#         self.assertEqual(dm.called, 1)
> -#         p._p_changed = 0
> -#         self.assertEqual(p._p_changed, 0)
> -#         self.assertEqual(dm.called, 1)
> -#         field = p['alpha']
> -#         field.title = u'Beta'
> -#         self.assertEqual(f._p_changed, 1)
> -#         self.assertEqual(p._p_changed, 1)
> -#         self.assertEqual(dm.called, 2)
> -
> -#     def testAddField(self):
> -#         f = Text(title=u'alpha')
> -#         p = self.klass()
> -#         p._p_oid = '\0\0\0\0\0\0hi'
> -#         dm = DM()
> -#         p._p_jar = dm
> -#         self.assertEqual(p._p_changed, 0)
> -#         self.assertEqual(dm.called, 0)
> -#         p.addField('alpha', f)
> -#         self.assertEqual(p._p_changed, 1)
> -#         self.assertEqual(dm.called, 1)
> -
> -#     def testRemoveField(self):
> -#         f = Text(title=u'alpha')
> -#         p = self.klass()
> -#         p._p_oid = '\0\0\0\0\0\0hi'
> -#         dm = DM()
> -#         p._p_jar = dm
> -#         self.assertEqual(p._p_changed, 0)
> -#         self.assertEqual(dm.called, 0)
> -#         p.addField('alpha', f)
> -#         self.assertEqual(p._p_changed, 1)
> -#         self.assertEqual(dm.called, 1)
> -#         p._p_changed = 0
> -#         self.assertEqual(p._p_changed, 0)
> -#         self.assertEqual(dm.called, 1)
> -#         p.removeField('alpha')
> -#         self.assertEqual(p._p_changed, 1)
> -#         self.assertEqual(dm.called, 2)
> -
> -    def tearDown(self):
> -        PersistentTest.tearDown(self)
> -        setup.placefulTearDown()
> -
> -def test_suite():
> -    suite = unittest.TestSuite()
> -    suite.addTest(unittest.makeSuite(PersistentSchemaUtilityTest))
> -    return suite
> -
> -if __name__ == '__main__':
> -    unittest.main()
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/tests/test_wrapper.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/tests/test_wrapper.py	 
> 2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/tests/test_wrapper.py	 
> 2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1,360 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Tests of persistent schema wrappers.
> -
> -$Id$
> -"""
> -import unittest
> -
> -from persistent import Persistent, GHOST, UPTODATE, CHANGED
> -from persistent.tests.persistenttestbase import DM as BaseDM,  
> BrokenDM
> -
> -from zope.interface import Interface, directlyProvides,  
> directlyProvidedBy
> -
> -from zope.app.schema.wrapper import Struct
> -from zope.app.container.contained import ContainedProxy,  
> getProxiedObject
> -
> -
> -class IDummy(Interface): pass
> -
> -class Dummy(object):
> -
> -    def __init__(self, x=0):
> -        self.x = x
> -
> -DUMMY = Dummy(42)
> -
> -class DM(BaseDM):
> -    def setstate(self, ob):
> -        ob.__setstate__({'__proxied__': DUMMY})
> -
> -def makeInstance(self):
> -    d = Dummy()
> -    p = Struct(d)
> -    return p
> -
> -class Test(unittest.TestCase):
> -
> -    klass = None # override in subclass
> -
> -    def tearDown(self):
> -        # Make sure that we leave the environment as we found it.
> -        global DUMMY
> -        DUMMY.__init__(42)
> -
> -    def testSaved(self):
> -        p = self.klass()
> -        p._p_oid = '\0\0\0\0\0\0hi'
> -        dm = DM()
> -        p._p_jar = dm
> -        self.assertEqual(p._p_changed, 0)
> -        self.assertEqual(dm.called, 0)
> -        p.x += 1
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 1)
> -        p.x += 1
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 1)
> -        p._p_deactivate()
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 1)
> -        p._p_deactivate()
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 1)
> -        p._p_invalidate()
> -        self.assertEqual(p._p_changed, None)
> -        self.assertEqual(dm.called, 1)
> -        p.x += 1
> -        self.assertEqual(p.x, 43)
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 2)
> -        p._p_changed = 0
> -        self.assertEqual(p._p_changed, 0)
> -        self.assertEqual(dm.called, 2)
> -        self.assertEqual(p.x, 43)
> -        p.x += 1
> -        self.assertEqual(p._p_changed, 1)
> -        self.assertEqual(dm.called, 3)
> -
> -    def testUnsaved(self):
> -        p = self.klass()
> -
> -        self.assertEqual(p.x, 0)
> -        self.assertEqual(p._p_changed, 0)
> -        self.assertEqual(p._p_jar, None)
> -        self.assertEqual(p._p_oid, None)
> -        p.x += 1
> -        p.x += 1
> -        self.assertEqual(p.x, 2)
> -        self.assertEqual(p._p_changed, 0)
> -
> -        p._p_deactivate()
> -        self.assertEqual(p._p_changed, 0)
> -        p._p_changed = 1
> -        self.assertEqual(p._p_changed, 0)
> -        p._p_deactivate()
> -        self.assertEqual(p._p_changed, 0)
> -        p._p_invalidate()
> -        self.assertEqual(p._p_changed, None)
> -        if self.has_dict:
> -            self.failUnless(p.__dict__)
> -        self.assertEqual(p.x, 2)
> -
> -    def testState(self):
> -        p = self.klass()
> -        d = Dummy()
> -        self.failUnless(p.__getstate__().has_key('__proxied__'))
> -        self.assertEqual(p._p_changed, 0)
> -        p.__setstate__({'__proxied__':d})
> -        self.assertEqual(p._p_changed, 0)
> -        if self.has_dict:
> -            p._v_foo = 2
> -        self.failUnless(p.__getstate__(), {'__proxied__': d})
> -        self.assertEqual(p._p_changed, 0)
> -
> -    def testSetStateSerial(self):
> -        p = self.klass()
> -        p._p_serial = 'abcdefgh'
> -        p.__setstate__(p.__getstate__())
> -        self.assertEqual(p._p_serial, 'abcdefgh')
> -
> -    def testDirectChanged(self):
> -        p = self.klass()
> -        p._p_oid = 1
> -        dm = DM()
> -        p._p_jar = dm
> -        self.assertEqual(p._p_changed, 0)
> -        self.assertEqual(dm.called, 0)
> -        p._p_changed = 1
> -        self.assertEqual(dm.called, 1)
> -
> -    def testGhostChanged(self):
> -        # If an object is a ghost and its _p_changed is set to  
> True (any
> -        # true value), it should activate (unghostify) the  
> object.  This
> -        # behavior is new in ZODB 3.6; before then, an attempt to do
> -        # "ghost._p_changed = True" was ignored.
> -        p = self.klass()
> -        p._p_oid = 1
> -        dm = DM()
> -        p._p_jar = dm
> -        p._p_deactivate()
> -        self.assertEqual(p._p_state, GHOST)
> -        p._p_changed = True
> -        self.assertEqual(p._p_state, CHANGED)
> -
> -    def testRegistrationFailure(self):
> -        p = self.klass()
> -        p._p_oid = 1
> -        dm = BrokenDM()
> -        p._p_jar = dm
> -        self.assertEqual(p._p_changed, 0)
> -        self.assertEqual(dm.called, 0)
> -        try:
> -            p._p_changed = 1
> -        except NotImplementedError:
> -            pass
> -        else:
> -            raise AssertionError("Exception not propagated")
> -        self.assertEqual(dm.called, 1)
> -        self.assertEqual(p._p_changed, 0)
> -
> -    def testLoadFailure(self):
> -        p = self.klass()
> -        p._p_oid = 1
> -        dm = BrokenDM()
> -        p._p_jar = dm
> -        p._p_deactivate()  # make it a ghost
> -
> -        try:
> -            p._p_activate()
> -        except NotImplementedError:
> -            pass
> -        else:
> -            raise AssertionError("Exception not propagated")
> -        self.assertEqual(p._p_changed, None)
> -
> -    def testActivate(self):
> -        p = self.klass()
> -        dm = DM()
> -        p._p_oid = 1
> -        p._p_jar = dm
> -        p._p_changed = 0
> -        p._p_deactivate()
> -        # ??? does this really test the activate method?
> -        p._p_activate()
> -        self.assertEqual(p._p_state, UPTODATE)
> -        self.assertEqual(p.x, 42)
> -
> -    def testDeactivate(self):
> -        p = self.klass()
> -        dm = DM()
> -        p._p_oid = 1
> -        p._p_deactivate() # this deactive has no effect
> -        self.assertEqual(p._p_state, UPTODATE)
> -        p._p_jar = dm
> -        p._p_changed = 0
> -        p._p_deactivate()
> -        self.assertEqual(p._p_state, GHOST)
> -        p._p_activate()
> -        self.assertEqual(p._p_state, UPTODATE)
> -        self.assertEqual(p.x, 42)
> -
> -# To do this right and expose both IPersistent and the
> -# underlying object's interfaces, we'd need to use a specialized
> -# descriptor.  This would create to great a dependency on
> -# zope.interface.
> -
> -#     def testInterface(self):
> -#         from persistent.interfaces import IPersistent
> -#         self.assert_(IPersistent.implementedBy(Persistent),
> -#                      "%s does not implement IPersistent" %  
> Persistent)
> -#         p = Persistent()
> -#         self.assert_(IPersistent.providedBy(p),
> -#                      "%s does not implement IPersistent" % p)
> -
> -#         self.assert_(IPersistent.implementedBy(Struct),
> -#                      "%s does not implement IPersistent" % Struct)
> -#         p = self.klass()
> -#         self.assert_(IPersistent.providedBy(p),
> -#                      "%s does not implement IPersistent" % p)
> -
> -    def testDataManagerAndAttributes(self):
> -        # Test to cover an odd bug where the instance __dict__ was
> -        # set at the same location as the data manager in the C type.
> -        p = self.klass()
> -        p.x += 1
> -        p.x += 1
> -        self.assert_('__proxied__' in p.__dict__)
> -        self.assert_(p._p_jar is None)
> -
> -    def testMultipleInheritance(self):
> -        # make sure it is possible to inherit from two different
> -        # subclasses of persistent.
> -        class A(Persistent):
> -            pass
> -        class B(Persistent):
> -            pass
> -        class C(A, B):
> -            pass
> -        class D(object):
> -            pass
> -        class E(D, B):
> -            pass
> -
> -    def testMultipleMeta(self):
> -        # make sure it's possible to define persistent classes
> -        # with a base whose metaclass is different
> -        class alternateMeta(type):
> -            pass
> -        class alternate(object):
> -            __metaclass__ = alternateMeta
> -        class mixedMeta(alternateMeta, type):
> -            pass
> -        class mixed(alternate, Persistent):
> -            __metaclass__ = mixedMeta
> -
> -    def testSlots(self):
> -        # Verify that Persistent classes behave the same way
> -        # as pure Python objects where '__slots__' and '__dict__'
> -        # are concerned.
> -
> -        class noDict(object):
> -            __slots__ = ['foo']
> -
> -        class shouldHaveDict(noDict):
> -            pass
> -
> -        class p_noDict(Persistent):
> -            __slots__ = ['foo']
> -
> -        class p_shouldHaveDict(p_noDict):
> -            pass
> -
> -        self.assertEqual(noDict.__dictoffset__, 0)
> -        self.assertEqual(p_noDict.__dictoffset__, 0)
> -
> -        self.assert_(shouldHaveDict.__dictoffset__ <> 0)
> -        self.assert_(p_shouldHaveDict.__dictoffset__ <> 0)
> -
> -    def testBasicTypeStructure(self):
> -        # test that a persistent class has a sane C type structure
> -        # use P (defined below) as simplest example
> -        self.assertEqual(Persistent.__dictoffset__, 0)
> -        self.assertEqual(Persistent.__weakrefoffset__, 0)
> -        self.assert_(Persistent.__basicsize__ > object.__basicsize__)
> -        self.assert_(Struct.__dictoffset__)
> -        self.assert_(Struct.__weakrefoffset__)
> -        self.assert_(Struct.__dictoffset__ <  
> Struct.__weakrefoffset__)
> -        self.assert_(Struct.__basicsize__ > Persistent.__basicsize__)
> -
> -    def testDeactivateErrors(self):
> -        p = self.klass()
> -        p._p_oid = '\0\0\0\0\0\0hi'
> -        dm = DM()
> -        p._p_jar = dm
> -
> -        def typeerr(*args, **kwargs):
> -            self.assertRaises(TypeError, p, *args, **kwargs)
> -
> -        typeerr(1)
> -        typeerr(1, 2)
> -        typeerr(spam=1)
> -        typeerr(spam=1, force=1)
> -
> -        p._p_changed = True
> -        class Err(object):
> -            def __nonzero__(self):
> -                raise RuntimeError
> -
> -        typeerr(force=Err())
> -
> -class PersistentTest(Test):
> -
> -    klass = makeInstance
> -    has_dict = 1
> -
> -    def testPicklable(self):
> -        import pickle
> -
> -        p = self.klass()
> -        p.x += 1
> -        p2 = pickle.loads(pickle.dumps(p))
> -        self.assertEqual(p2.__class__, p.__class__);
> -        self.failUnless(p2.__dict__.has_key('__proxied__'))
> -        self.assertEqual(p2.__dict__['__proxied__'].__dict__,
> -                         p.__dict__['__proxied__'].__dict__)
> -
> -    def testContainedPicklable(self):
> -        import pickle
> -
> -        p = self.klass()
> -        p = ContainedProxy(p)
> -        p.x += 1
> -        p2 = pickle.loads(pickle.dumps(p))
> -        pa = getProxiedObject(p)
> -        pb = getProxiedObject(p2)
> -        self.assertEqual(pb.__class__, pa.__class__);
> -        self.failUnless(pb.__dict__.has_key('__proxied__'))
> -        self.assertEqual(pb.__dict__['__proxied__'].__dict__,
> -                         pa.__dict__['__proxied__'].__dict__)
> -
> -    def testDirectlyProvides(self):
> -        p = self.klass()
> -        self.failIf(IDummy.providedBy(p))
> -        directlyProvides(p, directlyProvidedBy(p), IDummy)
> -        self.failUnless(IDummy.providedBy(p))
> -
> -
> -def test_suite():
> -    return unittest.makeSuite(PersistentTest)
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/wrapper.py
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/wrapper.py	2006-07-19  
> 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/wrapper.py	2006-07-19  
> 15:43:42 UTC (rev 69202)
> @@ -1,128 +0,0 @@
> - 
> ###################################################################### 
> ########
> -#
> -# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
> -# All Rights Reserved.
> -#
> -# This software is subject to the provisions of the Zope Public  
> License,
> -# Version 2.1 (ZPL).  A copy of the ZPL should accompany this  
> distribution.
> -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR  
> IMPLIED
> -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE  
> IMPLIED
> -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND  
> FITNESS
> -# FOR A PARTICULAR PURPOSE.
> -#
> - 
> ###################################################################### 
> ########
> -"""Provide persistent wrappers for objects that cannot derive from
> -persistence for some reason.
> -
> -$Id$
> -"""
> -from persistent import Persistent, GHOST
> -from zope.interface import implementedBy
> -from zope.security.checker import selectChecker
> -
> -class SecurityDescriptor(object):
> -    """ SecurityDescriptor is used by Struct to return the
> -    checker for the proxied object when its an instance,
> -    and return the checker for the Struct class, when its a class
> -    """
> -
> -    def __get__(self, inst, cls=None):
> -        if inst is None:
> -            return selectChecker(cls)
> -        else:
> -            # This is *VERY* tricky. There is a possibility that
> -            # the object was loaded, but not active by the time
> -            # __proxied__ needs to be accessed, which results
> -            # in an AttributeError here, which is swallowed
> -            # somewere inside the security machinery,
> -            # and then the object ends up using _defaultChecker
> -            #
> -            # Added the same code below, in ClassDescriptor,
> -            # though I'm not sure it is really needed there.
> -            if inst._p_state == GHOST:
> -                inst._p_activate()
> -            return selectChecker(inst.__proxied__)
> -
> -class ClassDescriptor(object):
> -    """ ClassDescriptor is used by Struct to return the
> -    real class for Struct when a class is being used, and return
> -    the proxied object's class when its an instance.
> -    """
> -
> -    def __get__(self, inst, cls=None):
> -        if inst is None:
> -            return cls
> -        else:
> -            if inst._p_state == GHOST:
> -                inst._p_activate()
> -            return inst.__proxied__.__class__
> -
> -
> -# Put those attributes in a list so its easier to add/remove
> -# when needed.
> -struct_attrs = ['__proxied__',
> -                '__dict__',
> -                '__reduce_ex__',
> -                '__reduce__',
> -                '__getstate__',
> -                '__setstate__',
> -                '__Security_checker__']
> -
> -class Struct(Persistent):
> -  """Wraps a non-persistent object, assuming that *all* changes are
> -  made through external attribute assignments.
> -  """
> -
> -  # TODO to do this right and expose both IPersistent and the
> -  # underlying object's interfaces, we'd need to use a specialized
> -  # descriptor.  This would create to great a dependency on
> -  # zope.interface.
> -
> -  __class__ = ClassDescriptor()
> -  __Security_checker__ = SecurityDescriptor()
> -
> -
> -  def __init__(self, o):
> -      self.__proxied__ = o
> -
> -  def __getattribute__(self, name):
> -      if name.startswith('_p_') or name in struct_attrs:
> -          v = Persistent.__getattribute__(self, name)
> -          # Handle descriptors here, eg: __Security_checker__
> -          # is a descriptor for Struct objects.
> -          if hasattr(v, '__get__'):
> -              return v.__get__(self, type(self))
> -          return v
> -      # TODO This is butt ugly. See the comment on  
> SecurityDescriptor.
> -      if self._p_state == GHOST:
> -          self._p_activate()
> -      proxied = self.__proxied__
> -      v = getattr(proxied, name)
> -      # And also handle descriptors for the proxied object,
> -      # but using the proxied object on __get__ calls.
> -      if hasattr(v, '__get__'):
> -          # We should call it only if it came from the class,
> -          # otherwise its a descriptor being used as an instance
> -          # attribute, so just return it.
> -          if (hasattr(proxied, '__class__') and
> -              getattr(proxied.__class__, name) is v):
> -              return v.__get__(proxied, type(proxied))
> -      return v
> -
> -  def __setattr__(self, name, v):
> -      if name.startswith('_p_') or name in struct_attrs:
> -          return Persistent.__setattr__(self, name, v)
> -      # Set _p_changed before calling the mutator on the
> -      # proxied object, so we have the object marked
> -      # as dirty even if an exception takes place later.
> -      self._p_changed = 1
> -      setattr(self.__proxied__, name, v)
> -
> -  def __delattr__(self, name):
> -      if name.startswith('_p_') or name in struct_attrs:
> -          return Persistent.__delattr__(self, name)
> -      # Set _p_changed before deleting the attribute. See
> -      # comment above, on __setattr__
> -      self._p_changed = 1
> -      delattr(self.__proxied__, name, v)
> -
>
> Deleted: Zope3/branches/3.3/src/zope/app/schema/zope.app.schema- 
> meta.zcml
> ===================================================================
> --- Zope3/branches/3.3/src/zope/app/schema/zope.app.schema- 
> meta.zcml	2006-07-19 15:41:39 UTC (rev 69201)
> +++ Zope3/branches/3.3/src/zope/app/schema/zope.app.schema- 
> meta.zcml	2006-07-19 15:43:42 UTC (rev 69202)
> @@ -1 +0,0 @@
> -<include package="zope.app.schema" file="meta.zcml" />
>
> _______________________________________________
> Checkins mailing list
> Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/checkins

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the Zope3-Checkins mailing list