[GRASS-SVN] r61664 - grass-addons/grass7/gui/wxpython/wx.metadata/mdlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 16 04:26:24 PDT 2014


Author: krejcmat
Date: 2014-08-16 04:26:24 -0700 (Sat, 16 Aug 2014)
New Revision: 61664

Modified:
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
Log:
fix output

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2014-08-16 10:25:57 UTC (rev 61663)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2014-08-16 11:26:24 UTC (rev 61664)
@@ -371,7 +371,7 @@
                     print "I/O error({0}): {1}".format(e.errno, e.strerror)
                     grass.fatal('ERROR: cannot write xml to file')
                     # sys.exit()
-                return path
+                return patha
         else:
             if os.path.isfile(path):
                 Module('g.message', message='Metadata file exists: %s' % path)
@@ -381,15 +381,24 @@
                         xml_file.write(iso_xml)
                         xml_file.close()
                         Module('g.message', message='Metadata file has been overwritten')
+                        return path
                     except IOError as e:
                         print "I/O error({0}): {1}".format(e.errno, e.strerror)
                         grass.fatal('error: cannot write xml to file')
-                        # sys.exit()
-                    return path
                 else:
-                    # TODO --o??
-                    Module('g.message', message='For overwriting use flag -o')
+                    Module('g.message', message='For overwriting use flag -overwrite')
                     return False
+            else: 
+                try:
+                    xml_file = open(path, "w")
+                    xml_file.write(iso_xml)
+                    xml_file.close()
+                    Module('g.message', message='Metadata file has been exported')
+                    return path
+                    
+                except IOError as e:
+                    print "I/O error({0}): {1}".format(e.errno, e.strerror)
+                    grass.fatal('error: cannot write xml to file')                
 
     def validate_inspire(self):
         return mdutil.isnpireValidator(self.md)



More information about the grass-commit mailing list