Beispiel #1
0
 def __call__(self, *args):
     islocalhost = self.request.URL.startswith('http://localhost')
     if self.request.method == 'GET' and not islocalhost:
         return self.http_get_edit()
     elif islocalhost:
         logger.info('doesn t support localhost editing at the moment')
         return 'localhost is not supported'
Beispiel #2
0
 def http_get_edit(self):
     """Use the http get picnik method.
     
     You must be warned it doesn't work with localhost
     """
     kwargs = {}
     context_url = self.context.absolute_url()
     kwargs['_apikey'] = self.apikey()
     kwargs['_import'] = context_url
     kwargs['_export'] = context_url + '/@@picnik_pull_handler'
     kwargs['_export_agent'] = 'browser'
     url = config.SERVICE_URL + '?' + urllib.urlencode(kwargs)
     logger.info(kwargs)
     self.request.response.redirect(url)
     return ''
from zope import interface
from zope import schema

from collective.picnik import logger, messageFactory as _
try:
    from Products.ATContentTypes.interfaces import IATImage as IImage
except ImportError, e:
    try:
        #plone4
        from Products.ATContentTypes.interfaces.image import IATImage as IImage
        logger.info('BBB: switch to plone4.0 %s'%e)
    except ImportError, e:
        logger.info('BBB: switch to plone3 %s'%e)
        #plone3
        from Products.ATContentTypes.interface import IATImage  as IImage


class IPicnikLayer(interface.Interface):
    """Browser layer for picnik addon"""

class PicnikConfiguration(interface.Interface):

    apikey = schema.ASCIILine(title=_(u"API KEY"),
                      description=_(u"You can create ask for an API KEY at \
                        https://www.picnik.com/keys/"),
                      default="")