#14 — wrong ADD_PERMISSIONS entry when adding contenttype with whitespace incontenttype_name
by
(anonymous)
—
last modified
Jan 22, 2010 01:46 AM
| State | Rejected |
|---|---|
| Version: |
—
|
| Area | General |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | (anonymous) |
| Submitted on | Mar 27, 2009 |
| Responsible |
—
|
| Target release: |
—
|
Hi everyone!
First of all, I am currentyl using PasteScript 1.7.3.
Atfer creating an archetype via 'paster create -t archetype', I wanted to build an new content type, using 'paster addcontent contenttype'.
And I did it like this:
patrick@athene:/opt/virginal_plone/src/bla.test/bla/test$ paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: Example Type
Enter contenttype_description (Content type description ) ['Description of the Example Type']:
Enter folderish (True/False: Content type is Folderish ) [False]:
Enter global_allow (True/False: Globally addable ) [True]:
Enter allow_discussion (True/False: Allow discussion ) [False]:
Inserting from README.txt_insert into /opt/virginal_plone/src/bla.test/bla/test/README.txt
Inserting from config.py_insert into /opt/virginal_plone/src/bla.test/bla/test/config.py
Recursing into content
Copying +content_class_filename+.py_tmpl to /opt/virginal_plone/src/bla.test/bla/test/content/exampletype.py
Inserting from configure.zcml_insert into /opt/virginal_plone/src/bla.test/bla/test/content/configure.zcml
Recursing into interfaces
Copying +content_class_filename+.py_tmpl to /opt/virginal_plone/src/bla.test/bla/test/interfaces/exampletype.py
Inserting from __init__.py_insert into /opt/virginal_plone/src/bla.test/bla/test/interfaces/__init__.py
Recursing into profiles
Recursing into default
Inserting from factorytool.xml_insert into /opt/virginal_plone/src/bla.test/bla/test/profiles/default/factorytool.xml
Copying rolemap.xml_insert to /opt/virginal_plone/src/bla.test/bla/test/profiles/default/rolemap.xml
Recursing into types
Creating /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types/
Copying +types_xml_filename+.xml_tmpl to /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types/Example_Type.xml
Inserting from types.xml_insert into /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types.xml
After restarting zope via 'bin/instance fg' it crashed with the following trace:
...
2009-03-27 12:39:34 ERROR Application Couldn't install bla.test
Traceback (most recent call last):
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 881, in install_package
init_func(newContext)
File "/opt/virginal_plone/src/bla.test/bla/test/__init__.py", line 48, in initialize
permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'ExampleType'
Traceback (most recent call last):
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/run.py", line 56, in ?
run()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/run.py", line 21, in run
starter.prepare()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 102, in prepare
self.startZope()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 278, in startZope
Zope2.startup()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/__init__.py", line 47, in startup
_startup()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/App/startup.py", line 102, in startup
OFS.Application.initialize(application)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 309, in initialize
initializer.initialize()
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 338, in initialize
self.install_products()
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 603, in install_products
return install_products(app)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 638, in install_products
install_package(app, module, init_func, raise_exc=debug_mode)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 881, in install_package
init_func(newContext)
File "/opt/virginal_plone/src/bla.test/bla/test/__init__.py", line 48, in initialize
permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'ExampleType'
I made it start, removing the white space in the config.py:
'ExampleType': 'bla.test: Add Example Type',
Bye,
Paddy
First of all, I am currentyl using PasteScript 1.7.3.
Atfer creating an archetype via 'paster create -t archetype', I wanted to build an new content type, using 'paster addcontent contenttype'.
And I did it like this:
patrick@athene:/opt/virginal_plone/src/bla.test/bla/test$ paster addcontent contenttype
Enter contenttype_name (Content type name ) ['Example Type']: Example Type
Enter contenttype_description (Content type description ) ['Description of the Example Type']:
Enter folderish (True/False: Content type is Folderish ) [False]:
Enter global_allow (True/False: Globally addable ) [True]:
Enter allow_discussion (True/False: Allow discussion ) [False]:
Inserting from README.txt_insert into /opt/virginal_plone/src/bla.test/bla/test/README.txt
Inserting from config.py_insert into /opt/virginal_plone/src/bla.test/bla/test/config.py
Recursing into content
Copying +content_class_filename+.py_tmpl to /opt/virginal_plone/src/bla.test/bla/test/content/exampletype.py
Inserting from configure.zcml_insert into /opt/virginal_plone/src/bla.test/bla/test/content/configure.zcml
Recursing into interfaces
Copying +content_class_filename+.py_tmpl to /opt/virginal_plone/src/bla.test/bla/test/interfaces/exampletype.py
Inserting from __init__.py_insert into /opt/virginal_plone/src/bla.test/bla/test/interfaces/__init__.py
Recursing into profiles
Recursing into default
Inserting from factorytool.xml_insert into /opt/virginal_plone/src/bla.test/bla/test/profiles/default/factorytool.xml
Copying rolemap.xml_insert to /opt/virginal_plone/src/bla.test/bla/test/profiles/default/rolemap.xml
Recursing into types
Creating /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types/
Copying +types_xml_filename+.xml_tmpl to /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types/Example_Type.xml
Inserting from types.xml_insert into /opt/virginal_plone/src/bla.test/bla/test/profiles/default/types.xml
After restarting zope via 'bin/instance fg' it crashed with the following trace:
...
2009-03-27 12:39:34 ERROR Application Couldn't install bla.test
Traceback (most recent call last):
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 881, in install_package
init_func(newContext)
File "/opt/virginal_plone/src/bla.test/bla/test/__init__.py", line 48, in initialize
permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'ExampleType'
Traceback (most recent call last):
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/run.py", line 56, in ?
run()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/run.py", line 21, in run
starter.prepare()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 102, in prepare
self.startZope()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/Startup/__init__.py", line 278, in startZope
Zope2.startup()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/__init__.py", line 47, in startup
_startup()
File "/opt/virginal_plone/parts/zope2/lib/python/Zope2/App/startup.py", line 102, in startup
OFS.Application.initialize(application)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 309, in initialize
initializer.initialize()
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 338, in initialize
self.install_products()
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 603, in install_products
return install_products(app)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 638, in install_products
install_package(app, module, init_func, raise_exc=debug_mode)
File "/opt/virginal_plone/parts/zope2/lib/python/OFS/Application.py", line 881, in install_package
init_func(newContext)
File "/opt/virginal_plone/src/bla.test/bla/test/__init__.py", line 48, in initialize
permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'ExampleType'
I made it start, removing the white space in the config.py:
'ExampleType': 'bla.test: Add Example Type',
Bye,
Paddy
Added by
Christopher Warner
on
Jun 09, 2009 04:32 PM
Can confirm, what's happening is that Paster is creating config.py with an empty ADD_PERMISSIONS but most people creating content types for the first time are going to have no idea. ADD_PERMISSIONS = {
# -*- extra stuff goes here -*-
}
The dict should probably just default to the type : description that was entered into paster upon setup
Added by
(anonymous)
on
Jun 17, 2009 04:49 PM
Awesome Thank You!!
Added by
Chris Shenton
on
Jul 24, 2009 04:48 PM
Paster created a config.py for me with ADD_PERMISSIONS having my content types and permissions, but for content types with names containing a space, it left the space in the name, and this didn't match the name-sans-spaces that it was trying to use. For example, ADD_PERMISSIONS had:'Teens Feature Link': 'teens.content: Add Teens Feature Link',
which would cause:
permission = config.ADD_PERMISSIONS[atype.portal_type],
KeyError: 'TeensFeatureLink'
but could be fixed by removing spaces from ADD_PERMISSIONS' key name:
'TeensFeatureLink': 'teens.content: Add Teens Feature Link',
Added by
xMartin
on
Oct 22, 2009 06:57 PM
If you addportal_type = 'My Content Type'
right next to where the paster put
meta_type = 'My Content Type'
then everything is fine. Spaces should be ok. ZopeSkel should add the portal_type.
Added by
Israel Saeta Pérez
on
Dec 31, 2009 03:46 PM
See http://plone.org/products/zopeskel/issues/22
Added by
Cris Ewing
on
Jan 22, 2010 01:46 AM
As pointed out by Israel above, this will be fixed by fixing http://plone.org/products/zopeskel/issues/22
Issue state:
Unconfirmed
→
Rejected
I'm going to close this as rejected as it is really a duplicate issue in disguise.
No responses can be added.
If you can, please log in before submitting a reaction.
