def __init__(self, context, inserts=[]): OdfEnvironment.__init__(self) # Buffer where we must dump the content we are currently reading self.currentBuffer = None # XML element content we are currently reading self.currentContent = '' # Current statement (a list of lines) that we are currently reading self.currentStatement = [] # Current mode self.mode = self.ADD_IN_SUBBUFFER # Current state self.state = self.READING_CONTENT # Stack of currently visited tables self.tableStack = [] self.tableIndex = -1 # Evaluation context self.context = context # For the currently read expression, is there style-related information # associated with it? self.exprHasStyle = False # Namespace definitions are not already encountered. self.gotNamespaces = False # Store inserts self.inserts = inserts # Currently walked "if" actions self.ifActions = [] # Currently walked named "if" actions self.namedIfActions = {} #~{s_statementName: IfAction}~
def __init__(self): OdfEnvironment.__init__(self) # Namespace definitions are not already encountered self.gotNamespaces = False # Names of some tags, that we will compute after namespace propagation self.tags = None self.styles = Styles() self.currentStyle = None # The currently parsed style definition # The found page layouts, keyed by their name self.pageLayouts = {} self.currentPageLayout = None # The currently parsed page layout # The name of the page layout defined for the whole document self.masterLayoutName = None self.state = READING
def getOdtContent(self, odtFile): '''Creates in the temp folder content.xml and styles.xml extracted from p_odtFile.''' contentXml = None stylesXml = None if odtFile == self.result: filePrefix = 'actual' else: filePrefix = 'expected' zipFile = zipfile.ZipFile(odtFile) for zippedFile in zipFile.namelist(): if zippedFile in self.interestingOdtContent: f = file( os.path.join(self.tempFolder, '%s.%s' % (filePrefix, zippedFile)), 'wb') fileContent = zipFile.read(zippedFile) if zippedFile == 'content.xml': # Sometimes, in annotations, there are Python tracebacks. # Those tracebacks include the full path to the Python # files, which of course may be different from one machine # to the other. So we remove those paths. annotationsRemover = AnnotationsRemover( OdfEnvironment(), self) annotationsRemover.parse(fileContent) fileContent = annotationsRemover.getResult() f.write(fileContent.encode('utf-8')) f.close() zipFile.close()
def __init__(self, context, inserts=None): OdfEnvironment.__init__(self) # Buffer where we must dump the content we are currently reading self.currentBuffer = None # XML element content we are currently reading self.currentContent = '' # Current statement (a list of lines) that we are currently reading self.currentStatement = [] # Current mode self.mode = self.ADD_IN_SUBBUFFER # Current state self.state = self.READING_CONTENT # Elements we must ignore (they will not be included in the result) self.ignorableElems = None # Will be set after namespace propagation # Elements that may be impacted by POD statements self.impactableElems = None # Idem # Elements representing start and end tags surrounding expressions self.exprStartElems = self.exprEndElems = None # Idem # Stack of currently visited tables self.tableStack = [] self.tableIndex = -1 # Evaluation context self.context = context # For the currently read expression, is there style-related information # associated with it? self.exprHasStyle = False # Namespace definitions are not already encountered. self.gotNamespaces = False # Store inserts self.inserts = inserts # Currently walked "if" actions self.ifActions = [] # Currently walked named "if" actions self.namedIfActions = {} #~{s_statementName: IfAction}~ # Currently parsed expression within an ODS template self.currentOdsExpression = None self.currentOdsHook = None # Names of some tags, that we will compute after namespace propagation self.tags = None # When an error occurs, must we raise it or write it into he current # buffer? self.raiseOnError = None # Will be initialized by PodParser.__init__
def __init__(self, context, inserts=None): OdfEnvironment.__init__(self) # Buffer where we must dump the content we are currently reading self.currentBuffer = None # XML element content we are currently reading self.currentContent = '' # Current statement (a list of lines) that we are currently reading self.currentStatement = [] # Current mode self.mode = self.ADD_IN_SUBBUFFER # Current state self.state = self.READING_CONTENT # Elements we must ignore (they will not be included in the result) self.ignorableElems = None # Will be set after namespace propagation # Elements that may be impacted by POD statements self.impactableElems = None # Idem # Elements representing start and end tags surrounding expressions self.exprStartElems = self.exprEndElems = None # Idem # Stack of currently visited tables self.tableStack = [] self.tableIndex = -1 # Evaluation context self.context = context # For the currently read expression, is there style-related information # associated with it? self.exprHasStyle = False # Namespace definitions are not already encountered. self.gotNamespaces = False # Store inserts self.inserts = inserts # Currently walked "if" actions self.ifActions = [] # Currently walked named "if" actions self.namedIfActions = {} #~{s_statementName: appy.pod.actions.If}~ # Currently parsed expression within an ODS template self.currentOdsExpression = None self.currentOdsHook = None # Names of some tags, that we will compute after namespace propagation self.tags = None # When an error occurs, must we raise it or write it into he current # buffer? self.raiseOnError = None # Will be initialized by PodParser.__init__
def __init__(self): OdfEnvironment.__init__(self) self.styles = Styles() self.state = READING self.currentStyle = None # The style definition currently parsed