Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to cmfplone with z3cform #13

Merged
merged 1 commit into from
May 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ and add support for storing the image data into ZODB blobs_.
.. _blobs: http://plone.org/products/plone.app.blob


Warning
-------

Version 2.x is for Plone 5 only.


Installation
------------

Expand Down
5 changes: 4 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Changelog
=========

1.1.3 (unreleased)
2.0.0 (unreleased)
------------------

- Move control panel to Products.CMFPlone
[vangheem]

- Remove unused import.
[gforcada]

Expand Down
30 changes: 0 additions & 30 deletions src/plone/app/imaging/configlet.py

This file was deleted.

21 changes: 10 additions & 11 deletions src/plone/app/imaging/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:cache="http://namespaces.zope.org/cache"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="plone.app.imaging">

<five:registerPackage package="." initialize=".initialize"/>

<include file="profiles.zcml" />

<class class="Products.Archetypes.Field.ImageField">
<implements interface="Products.Archetypes.interfaces.IImageField" />
</class>
Expand All @@ -28,19 +27,10 @@
for="Products.Archetypes.interfaces.IImageField"
factory=".scaling.ImageScaleFactory" />

<adapter
factory=".configlet.ImagingControlPanelAdapter" />

<permission
id="plone.app.controlpanel.Imaging"
title="Plone Site Setup: Imaging" />

<browser:page
name="imaging-controlpanel"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
class=".configlet.ImagingControlPanel"
permission="plone.app.controlpanel.Imaging" />

<browser:page
for="Products.Archetypes.interfaces.IBaseObject"
name="images"
Expand All @@ -54,4 +44,13 @@
ruleset="plone.stableResource"
/>

<genericsetup:registerProfile
name="default"
title="plone.app.imaging"
directory="profiles/default"
description="backward compatible profile. does not do anything"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
provides="Products.GenericSetup.interfaces.EXTENSION"
/>

</configure>
25 changes: 0 additions & 25 deletions src/plone/app/imaging/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
from Products.Archetypes.interfaces import IBaseObject as IATBaseObject
from zope.i18nmessageid import MessageFactory
from zope.interface import Interface, Attribute
from zope.schema import List, TextLine, Int

_ = MessageFactory('plone')


class IImagingSchema(Interface):
""" schema for configlet form """

allowed_sizes = List(
title=_(u'Allowed image sizes'),
description=_(u'Specify all allowed maximum image dimensions, '
'one per line. '
'The required format is <name> <width>:<height>.'),
value_type=TextLine(),
default=[],
required=False,
)

quality = Int(
title=_(u'Scaled image quality'),
description=_(u'A value for the quality of scaled images, from 1 '
'(lowest) to 95 (highest). A value of 0 will mean '
'plone.scaling\'s default will be used, which is '
'currently 88.'),
min=0,
max=95,
)


class IImageScale(Interface):
""" representation of a scaled image, providing access to its metdata
and actual payload data """
Expand Down
15 changes: 0 additions & 15 deletions src/plone/app/imaging/profiles.zcml

This file was deleted.

8 changes: 0 additions & 8 deletions src/plone/app/imaging/profiles/default/actionicons.xml

This file was deleted.

11 changes: 0 additions & 11 deletions src/plone/app/imaging/profiles/default/controlpanel.xml

This file was deleted.

4 changes: 0 additions & 4 deletions src/plone/app/imaging/profiles/default/metadata.xml

This file was deleted.

14 changes: 8 additions & 6 deletions src/plone/app/imaging/scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
from plone.app.imaging.interfaces import (
IImageScaling,
IImageScaleFactory,
IImagingSchema,
IStableImageScale,
)
from Products.CMFPlone.interfaces.controlpanel import IImagingSchema
from plone.app.imaging.scale import ImageScale
from Products.Five import BrowserView
from zope.component.hooks import getSite
from zope.interface import alsoProvides
from zope.interface import implements
from zope.traversing.interfaces import ITraversable, TraversalError
from zope.publisher.interfaces import IPublishTraverse, NotFound
from ZODB.POSException import ConflictError
from plone.registry.interfaces import IRegistry
from zope.component import getUtility


try:
Expand All @@ -33,8 +34,9 @@ class ImageScaleFactory(object):

def __init__(self, field):
self.field = field
imaging_schema = IImagingSchema(getSite())
self.quality = getattr(imaging_schema, 'quality', None)
registry = getUtility(IRegistry)
settings = registry.forInterface(IImagingSchema, prefix="plone", check=False)
self.quality = settings.quality

def create(self, context, **parameters):
value = self.field.get(context)
Expand Down Expand Up @@ -128,7 +130,7 @@ def scale(self, fieldname=None, scale=None, height=None, width=None,
**parameters):
if scale is not None:
available = self.getAvailableSizes(fieldname)
if not scale in available:
if scale not in available:
return None
width, height = available[scale]

Expand Down Expand Up @@ -164,7 +166,7 @@ def tag(self, fieldname=None, scale=None, height=None, width=None,

if scale is not None:
available = self.getAvailableSizes(fieldname)
if not scale in available:
if scale not in available:
return None
width, height = available[scale]

Expand Down
2 changes: 0 additions & 2 deletions src/plone/app/imaging/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ def setUpZope(self, app, configurationContext):

def setUpPloneSite(self, portal):
super(ImagingFixture, self).setUpPloneSite(portal)
# install sunburst theme
testing.applyProfile(portal, 'plone.app.imaging:default')

def tearDownZope(self, app):
super(ImagingFixture, self).tearDownZope(app)
Expand Down
8 changes: 8 additions & 0 deletions src/plone/app/imaging/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
from os.path import dirname, join
from plone.app.testing import TEST_USER_NAME
from plone.app.testing import TEST_USER_PASSWORD
from zope.component import queryUtility
from plone.registry.interfaces import IRegistry
from Products.CMFPlone.interfaces.controlpanel import IImagingSchema


def getSettings():
registry = queryUtility(IRegistry)
return registry.forInterface(IImagingSchema, prefix="plone", check=False)


def getData(filename):
Expand Down
100 changes: 0 additions & 100 deletions src/plone/app/imaging/tests/configlet.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/plone/app/imaging/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def test_suite():
suite = TestSuite()
for testfile in ['traversal.txt', 'transforms.txt', 'configlet.txt']:
for testfile in ['traversal.txt', 'transforms.txt']:
suite.addTest(layered(doctest.DocFileSuite(testfile,
package='plone.app.imaging.tests',
optionflags=optionflags),
Expand Down
Loading