[Zope3-checkins] CVS: zopeproducts/photo - __init__.py:1.2
interfaces.py:1.2
Bjorn Tillenius
bjoti777 at student.liu.se
Sun Sep 21 18:18:18 EDT 2003
Update of /cvs-repository/zopeproducts/photo
In directory cvs.zope.org:/tmp/cvs-serv26937
Modified Files:
__init__.py interfaces.py
Log Message:
Updated code to work after ParentGeddon and ReplaceSetObjectWithSetitem.
=== zopeproducts/photo/__init__.py 1.1 => 1.2 ===
--- zopeproducts/photo/__init__.py:1.1 Fri Aug 15 08:10:43 2003
+++ zopeproducts/photo/__init__.py Sun Sep 21 18:17:47 2003
@@ -96,12 +96,11 @@
self._data = data
self._deleteGeneratedDisplays()
im = Image(data)
- self.setObject(u'original', im)
+ self[u'original'] = im
self._displayIds['original'] = im.getImageSize()
data = property(getData, setData)
-
_currentDisplayId = 'medium'
def setCurrentDisplayId(self, displayId):
@@ -115,9 +114,8 @@
"""Gets the current display id"""
return self._getPhotoOption('currentDisplayId')
+ currentDisplayId = property(getCurrentDisplayId, setCurrentDisplayId)
- currentDisplayId = zapi.ContextProperty(getCurrentDisplayId,
- setCurrentDisplayId)
_resizeUtility = defaultImageResizer
def setResizeUtility(self, val):
@@ -128,8 +126,7 @@
"""Gets the resize utility."""
return self._getPhotoOption('resizeUtility')
- resizeUtility = zapi.ContextProperty(getResizeUtility,
- setResizeUtility)
+ resizeUtility = property(getResizeUtility, setResizeUtility)
# PUBLIC METHODS
def getDisplayIds(self):
@@ -158,8 +155,6 @@
return self.get(displayId)
- getImage = zapi.ContextMethod(getImage)
-
# PRIVATE METHODS
def _getPhotoOption(self, option):
@@ -173,8 +168,6 @@
else:
return getattr(self, '_' + option)
- _getPhotoOption = zapi.ContextMethod(_getPhotoOption)
-
def _deleteGeneratedDisplays(self):
for dispId in self.getDisplayIds():
if self.__contains__(dispId):
@@ -188,9 +181,8 @@
self.resizeUtility)
image = resizer.resize(Image(self.data), im_size, keep_aspect=True)
- self.setObject(displayId, image)
+ self[displayId] = image
- _generateDisplay = zapi.ContextMethod(_generateDisplay)
class PhotoSized:
=== zopeproducts/photo/interfaces.py 1.1 => 1.2 ===
--- zopeproducts/photo/interfaces.py:1.1 Fri Aug 15 08:10:43 2003
+++ zopeproducts/photo/interfaces.py Sun Sep 21 18:17:47 2003
@@ -18,7 +18,6 @@
from zope.app.interfaces.container import IContainer
from zope.app.services.servicenames import Utilities
-from zope.context import ContextProperty
from zope.component import getService, ComponentLookupError
from zope.interface import Interface, Attribute
from zope.schema import Text, TextLine, Bytes, EnumeratedTextLine, Bool
@@ -46,14 +45,14 @@
"""
resizeUtilities = []
try:
- us = getService(self, Utilities)
+ us = getService(self.context, Utilities)
for resize_util_reg in us.getUtilitiesFor(IImageResizeUtility):
resizeUtilities.append(resize_util_reg[0])
except ComponentLookupError:
resizeUtilities = []
return resizeUtilities
- allowed_values = ContextProperty(__allowed)
+ allowed_values = property(__allowed)
class IPhotoFolder(IContainer):
"""Marker interface in order to make it easier to upload photos.
More information about the Zope3-Checkins
mailing list