Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Dexterity Support #2

Merged
merged 2 commits into from

2 participants

@jone
Owner
  • Set UUID manually (plone.uuid) if _setUID is not there (Dexterity).
  • Do not clean up Schema stuff for dexterity.

See also 4teamwork/ftw.publisher.core#4

/cc @maethu

@maethu maethu merged commit 1495263 into master
@maethu maethu deleted the jone-dexterity branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. @jone

    Dexterity support.

    jone authored
  2. @jone
This page is out of date. Refresh to see the latest.
View
3  docs/HISTORY.txt
@@ -5,6 +5,9 @@ Changelog
2.0 (unreleased)
----------------
+- Dexterity support.
+ [jone]
+
- Do not unserialize schema fields on plone site root.
The plone site has no schema.
[tschanzt]
View
20 ftw/publisher/receiver/browser/views.py
@@ -1,3 +1,6 @@
+from Acquisition import aq_base
+from Acquisition import aq_inner
+from Acquisition import aq_parent
from DateTime import DateTime
from Products.CMFPlone.interfaces import IPloneSiteRoot
from Products.Five import BrowserView
@@ -9,8 +12,11 @@
from ftw.publisher.receiver.events import AfterCreatedEvent, AfterUpdatedEvent
from zope import event
from zope.component import getAdapters
+from zope.event import notify
+from zope.lifecycleevent import ObjectAddedEvent
from zope.publisher.interfaces import Retry
import os.path
+import plone.uuid
import sys
import traceback
@@ -211,7 +217,17 @@ def pushAction(self, metadata, data):
metadata['portal_type'],
metadata['id'],
))
- object._setUID(metadata['UID'])
+
+ if hasattr(aq_base(object), '_setUID'):
+ object._setUID(metadata['UID'])
+
+ else:
+ setattr(object,
+ plone.uuid.interfaces.ATTRIBUTE_NAME,
+ metadata['UID'])
+
+ notify(ObjectAddedEvent(object))
+
#object.processForm()
new_object = True
else:
@@ -221,7 +237,7 @@ def pushAction(self, metadata, data):
pass
# finalize
- if not is_root:
+ if hasattr(aq_base(object), 'processForm'):
object.processForm()
if not is_root:
View
5 ftw/publisher/receiver/decoder.py
@@ -1,4 +1,5 @@
from AccessControl.SecurityInfo import ClassSecurityInformation
+from Acquisition import aq_base
from Products.Archetypes.Field import FileField
from Products.Archetypes.Field import ImageField
from Products.Archetypes.Field import ReferenceField
@@ -132,6 +133,10 @@ def unserializeFields(self,object, jsonkey):
if IPloneSiteRoot.providedBy(object):
return self.data
+ if not hasattr(aq_base(object), 'Schema'):
+ # might be dexterity
+ return self.data
+
fields = object.Schema().fields()
for field in fields:
Something went wrong with that request. Please try again.