Commit 9a7d7af4 authored by 's avatar

Merged ZClass id restriction from 2.2 branch

parent c8382052
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
"""Zope Classes """Zope Classes
""" """
import Globals, string, OFS.SimpleItem, OFS.PropertySheets, Products import Globals, string, OFS.SimpleItem, OFS.PropertySheets, Products
import Method, Basic, Property, AccessControl.Role import Method, Basic, Property, AccessControl.Role, ts_regex
from ZPublisher.mapply import mapply from ZPublisher.mapply import mapply
from ExtensionClass import Base from ExtensionClass import Base
...@@ -124,12 +124,16 @@ def dbVersionEquals(ver): ...@@ -124,12 +124,16 @@ def dbVersionEquals(ver):
Globals.DatabaseVersion == ver Globals.DatabaseVersion == ver
bad_id=ts_regex.compile('[^a-zA-Z0-9_]').search
def manage_addZClass(self, id, title='', baseclasses=[], def manage_addZClass(self, id, title='', baseclasses=[],
meta_type='', CreateAFactory=0, REQUEST=None, meta_type='', CreateAFactory=0, REQUEST=None,
zope_object=0): zope_object=0):
"""Add a Z Class """Add a Z Class
""" """
if bad_id(id) != -1:
raise 'Bad Request', (
'The id %s is invalid as a class name.' % id)
if not meta_type: meta_type=id if not meta_type: meta_type=id
r={} r={}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment