KeyError: 'constrainTypesMode' when accessing my Archetypes

3 messages Options
Embed this post
Permalink
Ken Winter () KeyError: 'constrainTypesMode' when accessing my Archetypes
Reply Threaded More More options
Print post
Permalink
All of my Archetypes content objects have suddenly become broken.  All attempts to display existing objects (or create new ones) evoke this error: KeyError: 'constrainTypesMode'.  For some reason, the schemas of my content objects don't contain a field named 'constrainTypesMode'.

Some other schemas that show up in my event.log, which apparently belong to content types that I didn't write, do have the 'constrainTypesMode' field.

My event.logs reveal two more clues:

1. The type of my schemas of my objects is reported as "<type 'ImplicitAcquirerWrapper'>".  The other schemas have type "<class 'Products.Archetypes.Schema.Schema'>".

2. Though my objects' schemas don't the 'constrainTypesMode' field, my objects themselves do have an attribute named 'constrainTypesMode'.  

My Archetypes objects have worked fine for many months; I've never seen this problem before.  I assume I did something that inadvertently caused the problem, but I have no idea what.  I had never even heard of 'constrainTypesMode'.

I'm attaching excerpts from my event.log that illustrate all these points, including the full traceback.

Any ideas, how to fix this problem?

~ TIA
~ Ken

constrainTypesMode+event.log
Vincent Fretin () Re: KeyError: 'constrainTypesMode' when accessing my Archetypes
Reply Threaded More More options
Print post
Permalink
constrainTypesMode is used when you want to restrict the addeable
content type of a folder. You can configure it via the add
new->restrictions menu.
If you inherit from ATFolderSchema which inherit from
ConstrainTypesMixinSchema, you should have this attribute when you
create a folder.

Vincent Fretin
Ecreall
Site : http://vincentfretin.ecreall.com



On Thu, Jul 30, 2009 at 5:17 AM, Ken Winter<[hidden email]> wrote:

>
> All of my Archetypes content objects have suddenly become broken.  All
> attempts to display existing objects (or create new ones) evoke this error:
> KeyError: 'constrainTypesMode'.  For some reason, the schemas of my content
> objects don't contain a field named 'constrainTypesMode'.
>
> Some other schemas that show up in my event.log, which apparently belong to
> content types that I didn't write, do have the 'constrainTypesMode' field.
>
> My event.logs reveal two more clues:
>
> 1. The type of my schemas of my objects is reported as "<type
> 'ImplicitAcquirerWrapper'>".  The other schemas have type "<class
> 'Products.Archetypes.Schema.Schema'>".
>
> 2. Though my objects' schemas don't the 'constrainTypesMode' field, my
> objects themselves do have an attribute named 'constrainTypesMode'.
>
> My Archetypes objects have worked fine for many months; I've never seen this
> problem before.  I assume I did something that inadvertently caused the
> problem, but I have no idea what.  I had never even heard of
> 'constrainTypesMode'.
>
> I'm attaching excerpts from my event.log that illustrate all these points,
> including the full traceback.
>
> Any ideas, how to fix this problem?
>
> ~ TIA
> ~ Ken
>
> http://n2.nabble.com/file/n3354042/constrainTypesMode%2Bevent.log
> constrainTypesMode+event.log
> --
> View this message in context: http://n2.nabble.com/KeyError%3A-%27constrainTypesMode%27-when-accessing-my-Archetypes-tp3354042p3354042.html
> Sent from the Archetypes mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Archetypes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/archetypes-users
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Archetypes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/archetypes-users
Ken Winter () Re: KeyError: 'constrainTypesMode' when accessing my Archetypes
Reply Threaded More More options
Print post
Permalink
In reply to this post by Ken Winter
FWIW:

I solved the problem by reverting to an earlier version of my Archetype definitions.

I think the cause of the problem was that I added this new import line to the my Archetype code:

from Products.Archetypes.atapi import *

which already contained the import line:

from Products.Archetypes import public as atapi

My guess is that these caused incompatible imports, which led to my peculiar schema.

I've now removed the latter import line and changed the last line of the Archetype definition from

atapi.registerType(SF)

to:

registerType(SF)

and it still works fine.  Plus, the new import line gives some functionality that I needed.

~ Ken