Permalink
Browse files

Merge branch 'master' of github.com:collective/transmogrify.ploneremo…

…te into mergecollective

Conflicts:
	CHANGES.txt
	README.rst
	setup.cfg
	setup.py
	transmogrify/ploneremote/remoteconstructor.py
	transmogrify/ploneremote/remotenavigationexcluder.py
	transmogrify/ploneremote/remoteprune.py
	transmogrify/ploneremote/remoteredirector.py
	transmogrify/ploneremote/remoteschemaupdater.py
	transmogrify/ploneremote/remoteworkflowupdater.py
  • Loading branch information...
2 parents 756070d + fea98d0 commit b524ae45c72da75e6cc48cf1f05aed2c08041c6f Dylan Jay committed Apr 19, 2012
View
@@ -2,13 +2,18 @@
1.1 (2012-04-19)
----------------
-- remoteconstructor: handle uploading with moved content or content thats changed type
-- ploneprune: ignore items with no path
-- handle Protocol errors in schemaupdater
-- handle some xmlrpc errors better
-- add conditions so can skip existing
-- improve documentation
+- remoteconstructor: handle uploading with moved content or content thats changed type [djay]
+- ploneprune: ignore items with no path [djay]
+- handle Protocol errors in schemaupdater [djay]
+- handle some xmlrpc errors better [djay]
+- add conditions so can skip existing [djay]
+- improve documentation [djay]
+1.0b5 (2011-10-13)
+-------------------
+
+- Various bug fixes [aclark]
+- Depend on transmogrify.pathsorter [aclark]
1.0b4 (2011-06-29)
------------------
@@ -45,7 +50,7 @@
1.0a1 (2010-03-22)
-----------------
+------------------
- split from pretaweb.funnelweb and released
["Dylan Jay"]
View
@@ -32,28 +32,29 @@ transmogrify.ploneremote.constructor
Drop in replacement for constructor that will use xmlprc calls to construct content on a remote plone site
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
-:type-key:
+type-key
Key of the field with item type to create. Defaults to 'type','portal_type', 'Type','_type'
-:creation-key:
+creation-key
Key of the field to determine if item should be created. Defaults to '_creation_flag'
-:create-condition:
+create-condition
TAL expression to determine if item should be added. Defaults to 'python:True'
-:move-condition:
+move-condition
If the content has already been uploaded and then moved this TAL expression
will determine if the content should be moved back. Default is 'python:True'
-:remove-condition:
+remove-condition
If the content has already been uploaded and is of a different type this
TAL expression will determine if the item can be removed and recreated.
@@ -67,18 +68,19 @@ to set field values.
TODO: How to input schema fields
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
-:condition:
+condition
TAL Expression to determine to use this blueprint
-:skip-existing:
+skip-existing
Default is 'False'
@@ -88,15 +90,16 @@ transmogrify.ploneremote.remoteworkflowupdater
Triggers the state transition of the remote item workflow i.e.
publishes the item if it is not public.
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
-:transitions-key:
+transitions-key
which blueprint item dictionary key is used as the transition name
for the item.
@@ -123,28 +126,30 @@ Example::
[redirector]
blueprint = transmogrify.ploneremote.remoteredirector
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
transmogrify.ploneremote.remoteprune
====================================
Removes any items from a folder if it's not an item in the pipeline.
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
-:prune-folder-key:
+prune-folder-key
which transmogrifier field is read to check
if the prune folder is run against the remote folder.
The default value os "_prune-folder"
@@ -154,15 +159,16 @@ transmogrify.ploneremote.remotenavigationexcluder
Set "Exclude from Navigation" setting for remote Plone content items.
-Options:
+Options
+~~~~~~~
-:target:
- see `Common Options`_
+target
+ see `Common Options`
-:path-key:
- see `Common Options`_
+path-key
+ see `Common Options`
-:exclude-from-navigation-key:
+exclude-from-navigation-key
Which key we use to read navigation exclusion hint.
Default is 'exclude-from-navigation'
@@ -172,8 +178,10 @@ Authors
In the order of apperance
-* Dylan Jay, software@pretaweb.com
+* Dylan Jay, software@pretaweb.com http://www.pretaweb.com
* Mikko Ohtamaa, mikko@mfabrik.com, http://mfabrik.com
* Vitaliy Podoba, vitaliypodoba@gmail.com
+
+* Alex Clark, aclark@aclark.net, http://aclark.net
View
@@ -1,3 +0,0 @@
-[egg_info]
-tag_build =
-tag_svn_revision = true
View
@@ -5,16 +5,18 @@
setup(name='transmogrify.ploneremote',
version=version,
- description="Transmogrifier blueprints for uploading content via xmlrpc to a plone site",
+ description="""Transmogrifier blueprints for uploading content
+ via xmlrpc to a plone site""",
long_description=open('README.rst').read() + '\n' +
- #open(os.path.join("transmogrify", "ploneremote", "webcrawler.txt")).read() + "\n" +
- open(os.path.join( "CHANGES.txt")).read(),
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ #open(os.path.join("transmogrify", "ploneremote",
+ #"webcrawler.txt")).read() + "\n" +
+ open(os.path.join("CHANGES.txt")).read(),
classifiers=[
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
],
- keywords='transmogrifier blueprint funnelweb source plone import conversion microsoft office',
+ keywords="""transmogrifier blueprint funnelweb source plone import
+ conversion microsoft office""",
author='Dylan Jay',
author_email='software@pretaweb.com',
url='http://github.com/djay/transmogrify.ploneremote',
@@ -27,6 +29,7 @@
'setuptools',
# -*- Extra requirements: -*-
'collective.transmogrifier',
+ 'transmogrify.siteanalyser',
],
entry_points="""
[z3c.autoinclude.plugin]
@@ -1,3 +1,2 @@
from zope.i18nmessageid import MessageFactory
FunnelwebMessageFactory = MessageFactory('transmogrify.webcrawler')
-
@@ -5,26 +5,25 @@
from collective.transmogrifier.utils import Condition, Expression
from transmogrify.pathsorter.treeserializer import TreeSerializer
-from Acquisition import aq_base
-from Products.CMFCore.utils import getToolByName
import xmlrpclib
import urllib
-from urlparse import urlparse, urljoin
import logging
+
class RemoteConstructorSection(object):
classProvides(ISectionBlueprint)
implements(ISection)
-
- "Drop in replacement for constructor that will use xmlprc calls to construct content on a remote plone site"
+
+ """Drop in replacement for constructor that will use xmlprc calls
+ to construct content on a remote plone site"""
def __init__(self, transmogrifier, name, options, previous):
self.previous = TreeSerializer(transmogrifier, name, options, previous)
self.context = transmogrifier.context
#self.ttool = getToolByName(self.context, 'portal_types')
self.typekey = defaultMatcher(options, 'type-key', name, 'type',
- ('portal_type', 'Type','_type'))
+ ('portal_type', 'Type', '_type'))
self.pathkey = defaultMatcher(options, 'path-key', name, 'path')
self.creation_key = options.get('creation-key', '_creation_flag').strip()
self.target = options.get('target','')
@@ -47,11 +46,13 @@ def __iter__(self):
yield item
continue
keys = item.keys()
- type_, path = item.get(self.typekey(*keys)[0]), item.get(self.pathkey(*keys)[0])
+ type_, path = item.get(self.typekey(*keys)[0]), \
+ item.get(self.pathkey(*keys)[0])
item[self.creation_key] = False
if not (type_ and path): # not enough info
- yield item; continue
+ yield item
+ continue
path = path.encode('ascii')
parentpath = '/'.join(path.split('/')[:-1])
@@ -146,12 +147,10 @@ def __iter__(self):
self.logger.warning("Failuire while creating '%s' of type '%s: %s'"% (path, type_, e) )
pass
break
- except xmlrpclib.ProtocolError,e:
+ except xmlrpclib.ProtocolError, e:
if e.errcode == 503:
continue
else:
self.logger.error("%s raised %s"%(path,e))
#raise
-
yield item
-
@@ -1,40 +1,35 @@
-import urllib
import xmlrpclib
import logging
-from zope.interface import classProvides, implements
+from zope.interface import classProvides
from collective.transmogrifier.utils import defaultMatcher
from collective.transmogrifier.interfaces import ISectionBlueprint
from collective.transmogrifier.utils import Condition, Expression
-from base import PathBasedAbstractRemoteCommand
+from base import PathBasedAbstractRemoteCommand
logger = logging.getLogger('Plone')
+
class RemoteNavigationExcluderSection(PathBasedAbstractRemoteCommand):
"""
Set "Exclude from Navigation" setting for remote Plone content items.
"""
-
classProvides(ISectionBlueprint)
-
+
def readOptions(self, options):
- """ Read options give in pipeline.cfg.
+ """ Read options give in pipeline.cfg
"""
-
- # Call parent
+ # Call parent
PathBasedAbstractRemoteCommand.readOptions(self, options)
-
- # Which key we use to read navigation exclusion hint
- self.exclusion = defaultMatcher(options, 'exclude-from-navigation-key', self.name, 'exclude-from-navigation')
+ # Which key we use to read navigation exclusion hint
+ self.exclusion = defaultMatcher(options, 'exclude-from-navigation-key',
+ self.name, 'exclude-from-navigation')
def __iter__(self):
-
self.checkOptions()
-
for item in self.previous:
-
keys = item.keys()
typekey = self.typekey(*keys)[0]
pathkey = self.pathkey(*keys)[0]
@@ -45,8 +40,8 @@ def __iter__(self):
if not (typekey and pathkey): # not enough info
yield item
continue
-
- if path is None or type is None or exclude_from_nav is None or not self.target:
+ if (path is None or type is None or exclude_from_nav is None or not
+ self.target):
# The blueprint item did not provide necessary
# info to perform this pipeline transformation
yield item
@@ -57,17 +52,15 @@ def __iter__(self):
self.logger.info('%s skipping (condition)'%(path))
yield item; continue
- logger.debug("Setting exclude from navigation for " + path + " to " + str(exclude_from_nav))
-
- url = self.constructRemoteURL(item)
+ logger.debug("Setting exclude from navigation for " + path + " to "
+ + str(exclude_from_nav))
+ url = self.constructRemoteURL(item)
proxy = xmlrpclib.ServerProxy(url)
proxy.setExcludeFromNav(exclude_from_nav)
-
# Make sure the change is reflected to portal_catalog
- # TODO: Can't figure out how to pass named arguments to XML-RPC proxy
+ # TODO: Can't figure out how to pass named arguments to XML-RPC
+ # proxy
# proxy.reindexObject(arguments={"idxs" : ["exclude_from_nav"]})
-
proxy.reindexObject()
-
yield item
Oops, something went wrong.

0 comments on commit b524ae4

Please sign in to comment.