示例#1
0
    def write_template_to_file(prefix_dir,
        objectprefix,
        uniqueid,
        templatepath,
        context):
        """
        :param prefix_dir: The subdirectory off of the OAI_DOCS_PATH to store
        the resulting document in
        :type prefix_dir: string
        :param objectprefix: The name prefix of the resulting file. Files are
        output in the format prefix-uniqueid.xml
        :type objectprefix: string
        :param uniqueid: The unique ID of the file to be output
        :type uniqueid: string
        :param templatepath: The relative path to the Django template to be
        rendered
        :type templatepath: string
        :param context: The Context object (dictionary of variables for
        template output)
        :type context: :class:`django.template.context.Context`
        :returns: The full path to the created file
        :rtype: string
        """

        filename = settings.OAI_DOCS_PATH + path.sep + prefix_dir + \
            path.sep + str(objectprefix) + "-" + str(uniqueid) + ".xml"

        render_to_file(templatepath,
            filename, context)

        return filename
示例#2
0
    def write_template_to_file(prefix_dir, objectprefix, uniqueid,
                               templatepath, context):
        """
        :param prefix_dir: The subdirectory off of the OAI_DOCS_PATH to store
        the resulting document in
        :type prefix_dir: string
        :param objectprefix: The name prefix of the resulting file. Files are
        output in the format prefix-uniqueid.xml
        :type objectprefix: string
        :param uniqueid: The unique ID of the file to be output
        :type uniqueid: string
        :param templatepath: The relative path to the Django template to be
        rendered
        :type templatepath: string
        :param context: The Context object (dictionary of variables for
        template output)
        :type context: :class:`django.template.context.Context`
        :returns: The full path to the created file
        :rtype: string
        """

        filename = settings.OAI_DOCS_PATH + path.sep + prefix_dir + \
            path.sep + str(objectprefix) + "-" + str(uniqueid) + ".xml"

        render_to_file(templatepath, filename, context)

        return filename
示例#3
0
    def write_template_to_file(metadataprefix,
        objectprefix,
        uniqueid,
        templatepath,
        context):

        uniqueid = str(uniqueid).replace('MON:', '')

        filename = settings.OAI_DOCS_PATH + path.sep + "rif" + \
            path.sep + str(objectprefix) + "-" + uniqueid + ".xml"

        render_to_file(templatepath,
            filename, context)

        return filename
示例#4
0
 def write_template_to_dir(dest_dir, dest_filename, template_path, context):
     """
     :param dest_dir: The directory to store the resulting document in
     :type dest_dir: string
     :param dest_filename: The name of the file to be output
     :type dest_filename: string
     :param template_path: The relative path to the Django template to be
     rendered
     :type template_path: string
     :param context: The Context object (dictionary of variables for
     template output)
     :type context: :class:`django.template.context.Context`
     :returns: The full path to the created file
     :rtype: string
     """
     import os
     filename = os.path.join(dest_dir, dest_filename)
     render_to_file(template_path, filename, context)
     return filename
示例#5
0
 def write_template_to_dir(dest_dir, dest_filename, template_path, context):
     """
     :param dest_dir: The directory to store the resulting document in
     :type dest_dir: string
     :param dest_filename: The name of the file to be output
     :type dest_filename: string
     :param template_path: The relative path to the Django template to be
     rendered
     :type template_path: string
     :param context: The Context object (dictionary of variables for
     template output)
     :type context: :class:`django.template.context.Context`
     :returns: The full path to the created file
     :rtype: string
     """
     import os
     filename = os.path.join(dest_dir, dest_filename)
     render_to_file(template_path, filename, context)
     return filename