Author: gnichols Date: 2011-03-31 15:17:37 +0000 (Thu, 31 Mar 2011) New Revision: 858
Modified: trunk/v7/documentbase.py Log: 593982 - FEAT: test suite to remind users before the results.xml file becomes too large
Modified: trunk/v7/documentbase.py =================================================================== --- trunk/v7/documentbase.py 2011-03-31 12:41:05 UTC (rev 857) +++ trunk/v7/documentbase.py 2011-03-31 15:17:37 UTC (rev 858) @@ -14,7 +14,7 @@ # # Author: Greg Nichols # -import string, sys +import string, sys, os import time, datetime from xml.dom.minidom import getDOMImplementation, parse import xml.dom.ext @@ -223,6 +223,11 @@
class DocumentBase(DocumentWrapper):
+ def __init__(self): + DocumentWrapper.__init__(self) + self.loadedFilePath = None + self.loadedFileSize = 0 # bytes + def _new(self, topElement, stylesheet): dom = getDOMImplementation() self.document = dom.createDocument(None, topElement, None) @@ -236,6 +241,11 @@
def load(self, filename): + self.loadedFilePath = filename + try: + self.loadedFileSize = os.path.getsize(self.loadedFilePath) # bytes + except OSError: + pass file = open(filename, "r") self.document = parse(file) file.close() @@ -261,6 +271,13 @@ oldTopElement = self.document.childNodes[0] self.document.replaceChild(newTopElement, oldTopElement) self.element = self.document.documentElement + + def getLoadedFileSize(self): + """ return the size of the loaded xml file in bytes """ + return self.loadedFileSize + + def getLoadedFilePath(self): + return self.loadedFilePath
if __name__ == '__main__': @@ -315,3 +332,4 @@
+
v7-commits@lists.stg.fedorahosted.org