Les tests fonctionnels passent pour la génération des tuiles, nettoyages.
# 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
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
# 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
# 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
# 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
# -*- coding: utf-8 -*-
-####################################################
-# Copyright © 2009 Luxia SAS. All rights reserved. #
-# #
-# Contributors: #
-# - Benoît Pin <pinbe@luxia.fr> #
-####################################################
+############################################################
+# Copyright © 2005-2010 Benoît PIN <benoit.pin@ensmp.fr> #
+# 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
# -*- coding: utf-8 -*-
-####################################################
-# Copyright © 2009 Luxia SAS. All rights reserved. #
-# #
-# Contributors: #
-# - Benoît Pin <pinbe@luxia.fr> #
-####################################################
+############################################################
+# Copyright © 2005-2008 Benoît PIN <benoit.pin@ensmp.fr> #
+# 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
############################################################
""" 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
# -*- coding: utf-8 -*-
-####################################################
-# Copyright © 2009 Luxia SAS. All rights reserved. #
-# #
-# Contributors: #
-# - Benoît Pin <pinbe@luxia.fr> #
-####################################################
+############################################################
+# Copyright © 2005-2010 Benoît PIN <benoit.pin@ensmp.fr> #
+# 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
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) :
self.__stopped = True
def _process(self, app) :
-
path = self.queue.pop(0)
-
- #import Zope2
- #app = Zope2.app()
-
try :
p = app.unrestrictedTraverse(path)
except KeyError :
# 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
# 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