From: Benoît Pin Date: Tue, 27 Apr 2010 19:52:04 +0000 (+0200) Subject: validation des test et nettoyage X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/commitdiff_plain/2d47c9c3dc8e8265381e167514626f854a2a6f2b?ds=sidebyside;hp=e2ba855170902714ce38f4129abbe71209531457 validation des test et nettoyage Les tests fonctionnels passent pour la génération des tuiles, nettoyages. --- diff --git a/ImageManipulationTool.py b/ImageManipulationTool.py index 9c34580..4ec31f7 100755 --- a/ImageManipulationTool.py +++ b/ImageManipulationTool.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ Image manipulation tool -$Id: ImageManipulationTool.py 1391 2009-09-16 23:36:05Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/ImageManipulationTool.py $ """ from AccessControl import ClassSecurityInfo @@ -102,8 +100,13 @@ class ImageManipulationTool( UniqueObject, OrderedFolder) : if not self.isRunning() : utool = getToolByName(self, 'portal_url') + ctool = getToolByName(self, 'portal_catalog') portal = utool.getPortalObject() - thread = ImageQueueProcessorThread(portal.getPhysicalPath(), itemPath) + brains = ctool.unrestrictedSearchResults(portal_type='Photo', tiles_available=0) + paths = [b.getPath() for b in brains] + if itemPath is not None : + paths.insert(0, itemPath) + thread = ImageQueueProcessorThread(portal.getPhysicalPath(), paths) thread.start() path = self.absolute_url(1) queue_threads[path] = thread diff --git a/Portfolio.py b/Portfolio.py index bee4b4d..3012469 100755 --- a/Portfolio.py +++ b/Portfolio.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ Deprecated Image and Portfolio classes -$Id: Portfolio.py 622 2008-11-16 23:38:18Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/Portfolio.py $ """ from deprecated.Portfolio import Portfolio, Photo diff --git a/__init__.py b/__init__.py index f179dde..9b59eaa 100644 --- a/__init__.py +++ b/__init__.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ Image manipulation and presentation for CMF -$Id: __init__.py 626 2008-11-22 09:11:58Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/__init__.py $ """ from Products.CMFCore import utils as cmfutils diff --git a/container.py b/container.py index 1501cb5..11391aa 100755 --- a/container.py +++ b/container.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ container classes for photo storage. -$Id: container.py 622 2008-11-16 23:38:18Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/container.py $ """ from AccessControl import ClassSecurityInfo, Unauthorized diff --git a/event_handlers.py b/event_handlers.py index dec74bc..7e75286 100755 --- a/event_handlers.py +++ b/event_handlers.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- -#################################################### -# Copyright © 2009 Luxia SAS. All rights reserved. # -# # -# Contributors: # -# - Benoît Pin # -#################################################### +############################################################ +# Copyright © 2005-2010 Benoît PIN # +# Plinn - http://plinn.org # +# # +# This program is free software; you can redistribute it # +# and/or modify it under the terms of the Creative Commons # +# "Attribution-Noncommercial 2.0 Generic" # +# http://creativecommons.org/licenses/by-nc/2.0/ # +############################################################ """ Event handlers module - -$Id: event_handlers.py 1391 2009-09-16 23:36:05Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/event_handlers.py $ """ import transaction diff --git a/interfaces.py b/interfaces.py index 060540d..04f4281 100755 --- a/interfaces.py +++ b/interfaces.py @@ -1,14 +1,14 @@ # -*- coding: utf-8 -*- -#################################################### -# Copyright © 2009 Luxia SAS. All rights reserved. # -# # -# Contributors: # -# - Benoît Pin # -#################################################### +############################################################ +# Copyright © 2005-2008 Benoît PIN # +# Plinn - http://plinn.org # +# # +# This program is free software; you can redistribute it # +# and/or modify it under the terms of the Creative Commons # +# "Attribution-Noncommercial 2.0 Generic" # +# http://creativecommons.org/licenses/by-nc/2.0/ # +############################################################ """ Interfaces for Portfolio classes - -$Id: interfaces.py 1202 2009-07-15 08:48:42Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/interfaces.py $ """ from zope.interface import Interface diff --git a/lightbox.py b/lightbox.py index 962d913..98adde2 100755 --- a/lightbox.py +++ b/lightbox.py @@ -10,8 +10,6 @@ ############################################################ """ Lightboxes contains references to images. References are made with CMFUid stuff. -$Id: lightbox.py 622 2008-11-16 23:38:18Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/lightbox.py $ """ from Globals import InitializeClass diff --git a/manipulation.py b/manipulation.py index 8c057d6..a4623ba 100755 --- a/manipulation.py +++ b/manipulation.py @@ -1,21 +1,20 @@ # -*- coding: utf-8 -*- -#################################################### -# Copyright © 2009 Luxia SAS. All rights reserved. # -# # -# Contributors: # -# - Benoît Pin # -#################################################### +############################################################ +# Copyright © 2005-2010 Benoît PIN # +# Plinn - http://plinn.org # +# # +# This program is free software; you can redistribute it # +# and/or modify it under the terms of the Creative Commons # +# "Attribution-Noncommercial 2.0 Generic" # +# http://creativecommons.org/licenses/by-nc/2.0/ # +############################################################ """ Image threaded batch computation module - -$Id: manipulation.py 1391 2009-09-16 23:36:05Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/manipulation.py $ """ import threading import logging import atexit from types import StringTypes -#import Zope2 from math import ceil import transaction from ZODB.POSException import ConflictError @@ -38,23 +37,6 @@ class ImageQueueProcessorThread(threading.Thread) : itemsPath = [itemsPath] for i in itemsPath : self.queueAdd(i) - -# def __init__(self, portal_path, itemPath): -# threading.Thread.__init__(self) -# self.app = app = Zope2.app() -# self.portal = portal = app.unrestrictedTraverse(portal_path) -# self.imgTool = portal.portal_image_manipulation -# self.queue = [] -# if itemPath : -# self.queueAdd(itemPath) -# else : -# ctool = portal.portal_catalog -# brains = ctool.unrestrictedSearchResults(portal_type='Photo', tiles_available=0) -# for b in brains : -# self.queueAdd(b.getPath()) - - def __del__(self) : - print "ayé, c'est la fin !" @property def queueSize(self) : @@ -84,12 +66,7 @@ class ImageQueueProcessorThread(threading.Thread) : self.__stopped = True def _process(self, app) : - path = self.queue.pop(0) - - #import Zope2 - #app = Zope2.app() - try : p = app.unrestrictedTraverse(path) except KeyError : diff --git a/photo.py b/photo.py index 2508ebc..e7a10a1 100755 --- a/photo.py +++ b/photo.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ CMFAware Image -$Id: photo.py 1202 2009-07-15 08:48:42Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/photo.py $ """ from Globals import InitializeClass diff --git a/utils.py b/utils.py index 1fee07f..4ee5520 100755 --- a/utils.py +++ b/utils.py @@ -9,8 +9,6 @@ # http://creativecommons.org/licenses/by-nc/2.0/ # ############################################################ """ Global utilities for portfolio / photo objects. -$Id: utils.py 1200 2009-07-08 15:50:15Z pin $ -$URL: http://svn.luxia.fr/svn/labo/projects/zope/Portfolio/trunk/utils.py $ """ from AccessControl import ModuleSecurityInfo