Issue 68 in contentmirror: ReferenceTransform fails with None values

0 views
Skip to first unread message

conten...@googlecode.com

unread,
Jun 30, 2010, 4:56:10 PM6/30/10
to conten...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 68 by guitar...@vt.edu: ReferenceTransform fails with None values
http://code.google.com/p/contentmirror/issues/detail?id=68

What steps will reproduce the problem?
1. Get an old Plone (3.2.3) with crazy data from users (sorry, I have no
idea why my Data is so bad)
2. Run 'bin/instance run /path/to/bulk.py /'
3. It outputs tons of SQLAlchemy stuff, then bombs with this traceback:

{{{
Traceback (most recent call last):
File "<string>", line 1, in ?

File "parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/bulk.py",
line 87, in ?
main( app = app )

File "parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/bulk.py",
line 69, in main
serializer.update()

File "/var/plone/infocenters/parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/serializer.py",
line 40, in update
return self.add()

File "/var/plone/infocenters/parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/serializer.py",
line 34, in add
self._copy( peer )

File "/var/plone/infocenters/parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/serializer.py",
line 54, in _copy
peer.transformer.copy( self.context, peer )

File "/var/plone/infocenters/parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/transform.py",
line 52, in copy
transformer.copy( instance, peer )

File "/var/plone/infocenters/parts/productdistros/ContentMirror/eggs/ore.contentmirror-0.4.1-py2.4.egg/ore/contentmirror/transform.py",
line 285, in copy
t_oid = ob.UID()
AttributeError: 'NoneType' object has no attribute 'UID'
}}}

What version of the product are you using? On what operating system?

OK, so I found this with ContentMirror-0.4.1, but the source code is the
same in 0.6.0rc2.

I've hacked ReferenceTransform.copy() in transforms.py for myself:
{{{
def copy( self, instance, peer ):
value = self.context.getAccessor( instance )()

if not value:
return

if not isinstance( value, (list, tuple)):
value= [ value ]

#my hack - remove None values.
goods = [x for x in value where x is not None]
if len(goods) < 1:
return
value = goods

for ob in value:
t_oid = ob.UID()
}}}

conten...@googlecode.com

unread,
Jun 30, 2010, 5:03:19 PM6/30/10
to conten...@googlegroups.com

Comment #1 on issue 68 by guitar...@vt.edu: ReferenceTransform fails with
None values
http://code.google.com/p/contentmirror/issues/detail?id=68

Oops! The line should read:

goods = [x for x in value if x is not None]

NOTE: "if" instead of "where"

conten...@googlecode.com

unread,
Jul 9, 2010, 1:43:40 AM7/9/10
to conten...@googlegroups.com
Updates:
Status: Accepted
Owner: kapilt
Labels: Milestone-Release0.6

Comment #2 on issue 68 by kapilt: ReferenceTransform fails with None values
http://code.google.com/p/contentmirror/issues/detail?id=68

yeah.. contentmirror should try and be nice with 'bad' data and do the
right thing. its not clear why the reference value would contain a None.
I've added filtering of reference values on the trunk (rev 137).

incidentally, the minimal idiomatic python to do this is.

my_list = filter(None, my_list)

conten...@googlecode.com

unread,
Jul 28, 2010, 8:30:15 AM7/28/10
to conten...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 68 by kapilt: ReferenceTransform fails with None values
http://code.google.com/p/contentmirror/issues/detail?id=68

(No comment was entered for this change.)

Reply all
Reply to author
Forward
0 new messages