def getContext(self, **context):
        """
        Read all metadata fields from the file associated with the handler. Typically this is the first file
        encountered in processing. The assumption is that all files contain the global metadata
        to be associated with the project. The file path is in self.path, and may be changed if necessary.

        Calls ``readContext`` to read the file.

        Returns a context dictionary of fields discovered in the file.

        context
          Dictionary of initial field values, keyed on field names. If a field is initialized, it is not overwritten.
        """
        # If the first processed file does not contain the correct metadata,
        # reset self.path to the correct path
        #
        #   self.path = the_correct_metadata_file_path
        #
        # Call readContext to read the metadata into self.context
        IPCC5Handler.getContext(self, **context)

        # Add attribute/value pairs not contained in the file. For example,
        # to add an attribute 'creation_time' whose value is the current time (string):
        #
        # if self.context.get('creation_time', '')=='':
        #     self.context['creation_time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")

        # Return the context dictionary
        return self.context
Esempio n. 2
0
    def getContext(self, **context):
        """
        Read all metadata fields from the file associated with the handler. Typically this is the first file
        encountered in processing. The assumption is that all files contain the global metadata
        to be associated with the project. The file path is in self.path, and may be changed if necessary.

        Calls ``readContext`` to read the file.

        Returns a context dictionary of fields discovered in the file.

        context
          Dictionary of initial field values, keyed on field names. If a field is initialized, it is not overwritten.
        """
        # If the first processed file does not contain the correct metadata,
        # reset self.path to the correct path
        #
        #   self.path = the_correct_metadata_file_path
        #   
        # Call readContext to read the metadata into self.context
        IPCC5Handler.getContext(self, **context)

        # Add attribute/value pairs not contained in the file. For example,
        # to add an attribute 'creation_time' whose value is the current time (string):
        #
        # if self.context.get('creation_time', '')=='':
        #     self.context['creation_time'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")

        # Return the context dictionary
        return self.context
Esempio n. 3
0
    def getContext(self, **context):
        """
        Read all metadata fields from the file associated with the handler. Typically this is the first file
        encountered in processing. The assumption is that all files contain the global metadata
        to be associated with the project. The file path is in self.path, and may be changed if necessary.

        Calls ``readContext`` to read the file.

        Returns a context dictionary of fields discovered in the file.

        context
          Dictionary of initial field values, keyed on field names. If a field is initialized, it is not overwritten.
        """
        IPCC5Handler.getContext(self, **context)
        return self.context
Esempio n. 4
0
    def getContext(self, **context):
        """
        Read all metadata fields from the file associated with the handler. Typically this is the first file
        encountered in processing. The assumption is that all files contain the global metadata
        to be associated with the project. The file path is in self.path, and may be changed if necessary.

        Calls ``readContext`` to read the file.

        Returns a context dictionary of fields discovered in the file.

        context
          Dictionary of initial field values, keyed on field names. If a field is initialized, it is not overwritten.
        """
        IPCC5Handler.getContext(self, **context)
        return self.context