Commit f914da17 authored by 's avatar

Removed the manual wrapper checking from property mgmt; the database now

refuses to store wrapped objects, which makes the app-level checks no
longer necessary.
parent c33e3381
...@@ -87,9 +87,9 @@ ...@@ -87,9 +87,9 @@
Folders are the basic container objects and are analogous to directories. Folders are the basic container objects and are analogous to directories.
$Id: Folder.py,v 1.88 2000/05/16 19:34:43 brian Exp $""" $Id: Folder.py,v 1.89 2000/05/17 20:04:25 brian Exp $"""
__version__='$Revision: 1.88 $'[11:-2] __version__='$Revision: 1.89 $'[11:-2]
import Globals, SimpleItem, ObjectManager, PropertyManager import Globals, SimpleItem, ObjectManager, PropertyManager
import AccessControl.Role, webdav.Collection, FindSupport import AccessControl.Role, webdav.Collection, FindSupport
...@@ -112,7 +112,7 @@ def manage_addFolder(self, id, title='', ...@@ -112,7 +112,7 @@ def manage_addFolder(self, id, title='',
""" """
ob=Folder() ob=Folder()
ob.id=str(id) ob.id=str(id)
ob.title=str(title) ob.title=title
self._setObject(id, ob) self._setObject(id, ob)
ob=self._getOb(id) ob=self._getOb(id)
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Property management""" """Property management"""
__version__='$Revision: 1.21 $'[11:-2] __version__='$Revision: 1.22 $'[11:-2]
import ExtensionClass, Globals import ExtensionClass, Globals
import ZDOM import ZDOM
...@@ -289,14 +289,9 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes): ...@@ -289,14 +289,9 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
# Web interface # Web interface
def _wrapperCheck(self, object):
if hasattr(object, 'aq_base'):
raise ValueError, 'Invalid property value: wrapped object'
def manage_addProperty(self, id, value, type, REQUEST=None): def manage_addProperty(self, id, value, type, REQUEST=None):
"""Add a new property via the web. Sets a new property with """Add a new property via the web. Sets a new property with
the given id, type, and value.""" the given id, type, and value."""
self._wrapperCheck(value)
if type_converters.has_key(type): if type_converters.has_key(type):
value=type_converters[type](value) value=type_converters[type](value)
self._setProperty(id, value, type) self._setProperty(id, value, type)
...@@ -308,7 +303,6 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes): ...@@ -308,7 +303,6 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
for prop in self._properties: for prop in self._properties:
name=prop['id'] name=prop['id']
value=REQUEST.get(name, '') value=REQUEST.get(name, '')
self._wrapperCheck(value)
self._setPropValue(name, value) self._setPropValue(name, value)
return MessageDialog( return MessageDialog(
title ='Success!', title ='Success!',
...@@ -335,9 +329,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes): ...@@ -335,9 +329,7 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
if self.hasProperty(name): if self.hasProperty(name):
if not 'w' in propdict[name].get('mode', 'wd'): if not 'w' in propdict[name].get('mode', 'wd'):
raise 'BadRequest', '%s cannot be changed' % name raise 'BadRequest', '%s cannot be changed' % name
self._wrapperCheck(value)
self._setPropValue(name, value) self._setPropValue(name, value)
if REQUEST is not None: if REQUEST is not None:
return MessageDialog( return MessageDialog(
title ='Success!', title ='Success!',
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Property sheets""" """Property sheets"""
__version__='$Revision: 1.44 $'[11:-2] __version__='$Revision: 1.45 $'[11:-2]
import time, string, App.Management, Globals import time, string, App.Management, Globals
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
...@@ -396,14 +396,6 @@ class PropertySheet(Persistent, Implicit): ...@@ -396,14 +396,6 @@ class PropertySheet(Persistent, Implicit):
" " " "
raise 'Redirect', URL1+'/manage' raise 'Redirect', URL1+'/manage'
def _wrapperCheck(self, object):
# Raise an error if object appears to be wrapped. If a
# PropertySheet implementation ever needs to store wrapped
# objects for some reason, it will need to override this
# method.
if hasattr(object, 'aq_base'):
raise ValueError, 'Invalid property value: wrapped object'
def manage_addProperty(self, id, value, type, REQUEST=None): def manage_addProperty(self, id, value, type, REQUEST=None):
"""Add a new property via the web. Sets a new property with """Add a new property via the web. Sets a new property with
the given id, type, and value.""" the given id, type, and value."""
...@@ -425,7 +417,6 @@ class PropertySheet(Persistent, Implicit): ...@@ -425,7 +417,6 @@ class PropertySheet(Persistent, Implicit):
propdict=self._propdict() propdict=self._propdict()
for name, value in props.items(): for name, value in props.items():
if self.hasProperty(name): if self.hasProperty(name):
self._wrapperCheck(value)
self._updateProperty(name, value) self._updateProperty(name, value)
if REQUEST is not None: if REQUEST is not None:
return MessageDialog( return MessageDialog(
...@@ -438,7 +429,6 @@ class PropertySheet(Persistent, Implicit): ...@@ -438,7 +429,6 @@ class PropertySheet(Persistent, Implicit):
for prop in self.propertyMap(): for prop in self.propertyMap():
name=prop['id'] name=prop['id']
value=REQUEST.get(name, '') value=REQUEST.get(name, '')
self._wrapperCheck(value)
self._updateProperty(name, value) self._updateProperty(name, value)
return MessageDialog( return MessageDialog(
title ='Success!', title ='Success!',
......
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