From cc95bd1ca5e69ce13766ca0acea11560531ed620 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Tue, 24 May 2016 08:01:55 +0000
Subject: [PATCH] From snapshots, raw tape configuration is extracted and written into tape file and not the rendered one

---
 python/trisurf/trisurf.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/python/trisurf/trisurf.py b/python/trisurf/trisurf.py
index 310b4d3..bed6f7d 100644
--- a/python/trisurf/trisurf.py
+++ b/python/trisurf/trisurf.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
 import configobj
 import xml.etree.ElementTree as ET
 import base64
@@ -84,6 +82,9 @@
 		'''
 		try:
 			self.config=configobj.ConfigObj(tape)
+			with open (tape, "r") as myfile:
+				self.rawText=myfile.read() #read the file
+
 		except:
 			print("Error reading or parsing tape file!\n")
 			exit(1)
@@ -91,6 +92,7 @@
 	def setTape(self, string):
 		'''Method setTape(string) parses the string in memory that hold the tape contents.'''
 		self.config=configobj.ConfigObj(io.StringIO(string))
+		self.rawText=string
 		return
 
 	def getValue(self,key):
@@ -364,8 +366,8 @@
 				else:
 					try:
 						with open (os.path.join(self.Dir.fullpath(),"tape"), "w") as myfile:
-							myfile.write("#This is automatically generated tape file from snapshot")
-							myfile.write(str(self.tape))
+							#myfile.write("#This is automatically generated tape file from snapshot")
+							myfile.write(str(self.tape.rawText))
 					except:
 						print("Error -- cannot make tapefile  "+ os.path.join(self.Dir.fullpath(),"tape")+" from the snapshot in the running directory")
 						exit(1)

--
Gitblit v1.9.3