-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any plans for a new release? Then we can avoid using collective.blueprint.jsonmigrator in some situations. #13
Comments
+1. I just had about 36 hours of json migration frustration. At least you've figured out a kludge in the meantime. For the rest of us this would be very useful. |
@thet Can you help us here? Would it be the case to update https://github.com/collective/collective.blueprint.jsonmigrator docs and say collective.jsonmigrator is preferred? |
See my comments at collective/collective.jsonify#20 (comment) |
@idgserpro I never used collective.blueprint.jsonmigrator (though I have used collective.jsonmigrator quite a lot a year or two back). Can you clarify why you need that product? (same question to @pigeonflight too) As I understand it, @garbas created collective.jsonmigrator as a replacement for collective.blueprint.jsonmigrator. |
@djowett you're right, there's no need for collective.blueprint.jsonmigrator. The docs we used were misleading. The JSON source is already in a blueprint.py file in collective.jsonmigrator, and it could be used instead of the one from collective.blueprint.jsonmigrator, but it's not registered in it's configure.zcml file as an utility so you need to register it in your own package. It's still a moving part. I'm talking about the 0.2 release from pypi. But that aside, we still have a problematic line like the one in https://github.com/collective/collective.blueprint.jsonmigrator/blob/e14a5c61927f595f34a239f6c043ca18401d14a3/collective/blueprint/jsonmigrator/blueprint.py#L67 that needs a patch to work with datafiles and that's why we're asking for a new release since it's now fixed. And my 0.02c: if @garbas can confirm what you're saying (actually that's true following this commit), I suggest documenting https://github.com/collective/collective.blueprint.jsonmigrator as deprecated in favor of collective.jsonmigrator, in it's README and possibly in it's setup.py as
|
@idgserpro I agree with your 2c - make the PR & I'll merge it (@thet that's sane right?) I'm not sure what's the issue with that line... and I wouldn't advise a release to fix an issue without a PR review first. Can you not work from a checked out source rather than 0.2 egg? |
The issue with that line is explained in the first message of this issue:
That line is not needed anymore since the datafields blueprint handles that for us. Yes, we can work from a checked out source, but it's not optimal since it's not an official release from pypi (it's a 0.3.dev0 release that we're using), and more people could benefit from a new release. Having a new release, you need just a json from collective.jsonify and a transmogrifier.cfg in your policy product like we suggested, and not all the moving parts and patches like we said in the first message. AFAICT, from this comment, we can wait for @ericof 's opinion as well since he's is the package owner on pypi. |
i'd prefer to have all activity here. collective.blueprint.jsonmigrator is abandoned and this here is the successor. though, i don't know how much of the functionality is already implemented here. |
Version 0.3 was released on pypi earlier today. |
Thanks to all involved! It's working flawlessly. |
At this moment, if I want to use a json source blueprint I need https://github.com/collective/collective.blueprint.jsonmigrator, but if I want a datafields blueprint that works then I need the one from collective.jsonmigrator. You can use the JSONSource blueprint from collective.jsonmigrator but you need to register the JSONSource as an utility in your configure.zcml since it's not available in collective.jsonmigrator configure.zcml.
The problem is: when using collective.blueprint.jsonmigrator with an exported json from collective.jsonify that has a File content, I get the error
AttributeError: 'dict' object has no attribute 'startswith'
Thus I need to patch this line to properly use the json source blueprint (the datafield is a dict but the original code expects a string). This line was even removed in new versions of collective.jsonmigrator.
This situation is not optimal and really confusing since we have three moving parts: collective.blueprint.jsonmigrator, collective.jsonmigrator and a patch (and if you're using the configure.zcml approach is still a moving part).
After reading collective.jsonmigrator source code I've seen that you have added a json source along datafields blueprint. Testing Archetypes export with collective.jsonify with
File
content and trying to import it using collective.jsonmigrator 0.3.dev0 unreleased, it works. I'm using a Plone 4.3.7 installation.So, creating a new 0.3 release we can ease this pain and the cruft of adding a 5 year old package just for the json source blueprint.
This is specially useful as well when creating policy packages that create default content. Here's is a simple
transmogrifier.cfg
and asetuphandlers.py
snippet we used for testing the 0.3.dev0 unreleased collective.jsonmigrator package, after just usingexport_content
from collective.jsonify.[transmogrifier] pipeline = source inserter folders constructor workflowupdater atschemaupdater datafields reindexobject [inserter] blueprint = collective.transmogrifier.sections.inserter key = string:_path value = python:item['_path'].replace('/Plone', '') [source] blueprint = collective.jsonmigrator.jsonsource path = my.package:initcontent/ [folders] blueprint = collective.transmogrifier.sections.folders [constructor] blueprint = collective.transmogrifier.sections.constructor [mimetype] blueprint = collective.jsonmigrator.mimetype [properties] blueprint = collective.jsonmigrator.properties [datafields] blueprint = collective.jsonmigrator.datafields [atschemaupdater] blueprint = plone.app.transmogrifier.atschemaupdater [workflowupdater] blueprint = plone.app.transmogrifier.workflowupdater path-key = _path transitions-key = _transitions [reindexobject] blueprint = plone.app.transmogrifier.reindexobject
The text was updated successfully, but these errors were encountered: