<div dir="ltr"><div><div><div><div><div><div>Hi Tom,<br><br></div>Sorry for the late response. I was traveling. Continuing on this issue, I edited the geonode/layers/metadata.py according to your commit [1]. I then tried to add the shapefile which had the offending metadata xml file and I received the error "Cannot use None as a query value"<br><br></div>My workflow is the following:<br></div>1) Download the shapefile and the metadata (ISO XML) from an old geonode (running v2.4)<br></div>2) Rename the metadata xml file to be the same as the shapefile<br></div>3) Upload the shapefile+metadata (xml) in the new geonode server (v2.4).<br><br></div>I'm attaching the error I get when running geonode updatelayers<br><div><div><div><div><div><div><br></div><div>Thanks for the help<br></div><div>Daniel<br></div><div><br>[1] <a href="https://github.com/GeoNode/geonode/commit/562af5f1b76cd785ecfb9ae996522a701c3f6dd5">https://github.com/GeoNode/geonode/commit/562af5f1b76cd785ecfb9ae996522a701c3f6dd5</a><br></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 25, 2016 at 10:02 PM, Tom Kralidis <span dir="ltr"><<a href="mailto:tomkralidis@gmail.com" target="_blank">tomkralidis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel:<br>
<span class=""><br>
On Wed, Apr 13, 2016 at 2:43 PM, Daniel Victoria<br>
<<a href="mailto:daniel.victoria@gmail.com">daniel.victoria@gmail.com</a>> wrote:<br>
> Hi Tom et al.,<br>
><br>
> I saw that you closed the issue. Great. Two questions though<br>
> 1) Was the problem related to how the metadata was produced (incomplete)? Or<br>
> related to geonode not accepting incomplete data?<br>
><br>
<br>
</span>I would say both. Was the metadata produced in GeoNode?  If you can reproduce<br>
a workflow, this will help us validate it's a GeoNode metadata<br>
handling issue that<br>
we can then fix.<br>
<br>
Thanks<br>
<span class="HOEnZb"><font color="#888888"><br>
..Tom<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> 2) I'm a newbie when it comes to updating GeoNode. I have it installed from<br>
> the ppa repositories. How can I apply the patch you just comited? Should I<br>
> just convert the GeoNode install folder from my machine into a git<br>
> repository and pull from Github? Are there any tutorials on how to do that?<br>
><br>
> Thanks<br>
> Daniel<br>
><br>
><br>
> On Tue, Apr 12, 2016 at 10:40 PM, Daniel Victoria<br>
> <<a href="mailto:daniel.victoria@gmail.com">daniel.victoria@gmail.com</a>> wrote:<br>
>><br>
>> Thanks Tom, I just opened an issue[1].<br>
>><br>
>> Now, getting back to my problem of getting the metadata from one GeoNode<br>
>> server to another. What would be the best option? I tried downloading the<br>
>> XML and putting it along with the shapefile since I'd rather not have to<br>
>> fill 100+ metadata records by hand.<br>
>><br>
>> What about the migration scripts from afabiani. Will that move both the<br>
>> data (vector data in postgis or imagens in GeoServer) along with the<br>
>> metadata?<br>
>><br>
>> Cheers<br>
>> Daniel<br>
>><br>
>> [1] <a href="https://github.com/GeoNode/geonode/issues/2469" rel="noreferrer" target="_blank">https://github.com/GeoNode/geonode/issues/2469</a><br>
>><br>
>> On Tue, Apr 12, 2016 at 5:27 PM, Tom Kralidis <<a href="mailto:tomkralidis@gmail.com">tomkralidis@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> On Tue, Apr 12, 2016 at 12:39 PM, Daniel Victoria<br>
>>> <<a href="mailto:daniel.victoria@gmail.com">daniel.victoria@gmail.com</a>> wrote:<br>
>>> > Hi all,<br>
>>> ><br>
>>> > I'm trying to populate a new geonode instance (v2.4) with some<br>
>>> > shapefiles<br>
>>> > from another geonode (v2.4).<br>
>>> ><br>
>>> > I have all the shapefiles in a directory so I'm inclined to use the<br>
>>> > importlayers command. And to make things easier, I've downloaded the<br>
>>> > metadata (ISO format, XML file) from the former geonode and placed it<br>
>>> > with<br>
>>> > the shapefiles that will be imported.<br>
>>> ><br>
>>> > The importlayers command fails with the following message<br>
>>> ><br>
>>> > ./par_a01_2013_inventoryplotsubplot.shp<br>
>>> > ================<br>
>>> > Traceback (most recent call last):<br>
>>> >   File<br>
>>> > "/usr/local/lib/python2.7/dist-packages/geonode/layers/utils.py",<br>
>>> > line 588, in upload<br>
>>> >     title=title<br>
>>> >   File<br>
>>> > "/usr/local/lib/python2.7/dist-packages/geonode/layers/utils.py",<br>
>>> > line 429, in file_upload<br>
>>> >     vals, regions, keywords = set_metadata(xml_file.read())<br>
>>> >   File<br>
>>> > "/usr/local/lib/python2.7/dist-packages/geonode/layers/metadata.py",<br>
>>> > line 62, in set_metadata<br>
>>> >     vals, regions, keywords = dc2dict(exml)<br>
>>> >   File<br>
>>> > "/usr/local/lib/python2.7/dist-packages/geonode/layers/metadata.py",<br>
>>> > line 198, in dc2dict<br>
>>> >     vals['date'] = sniff_date(mdata.modified)<br>
>>> >   File<br>
>>> > "/usr/local/lib/python2.7/dist-packages/geonode/layers/metadata.py",<br>
>>> > line 222, in sniff_date<br>
>>> >     return datetime.datetime.strptime(datestr.strip(), dfmt)<br>
>>> > AttributeError: 'NoneType' object has no attribute 'strip'<br>
>>> ><br>
>>> > If I remove the XML file from the shapefile directory, the importlayers<br>
>>> > command works OK.<br>
>>> ><br>
>>> > Any idea what is wrong? Attached is the offending metadata file, just<br>
>>> > in<br>
>>> > case.<br>
>>> > Cheers<br>
>>> > Daniel<br>
>>><br>
>>> Daniel: looks like missing metadata.  Having said this, we should have a<br>
>>> more<br>
>>> graceful error.  If you can open a GitHub issue [1], I will fix.<br>
>>><br>
>>> Thanks<br>
>>><br>
>>> ..Tom<br>
>>><br>
>>> [1] <a href="https://github.com/GeoNode/geonode/issues/new" rel="noreferrer" target="_blank">https://github.com/GeoNode/geonode/issues/new</a><br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>