Example #1
0
def exportPresentation(request, client, filename, stylesDir):
    """
    export client to a DOM presentation
    """

    try:
        # filename is a directory where we will export the website to
        # We assume that the user knows what they are doing
        # and don't check if the directory is already full or not
        # and we just overwrite what's already there
        filename = Path(filename)
        # Append the package name to the folder path if necessary
        if filename.basename() != package.name:
            filename /= package.name
        if not filename.exists():
            filename.makedirs()
        elif not filename.isdir():
            client.alert(_(u"Filename %s is a file, cannot replace it") % filename)
            log.error("Couldn't export web page: " + "Filename %s is a file, cannot replace it" % filename)
            return
        else:
            client.alert(
                _(u"Folder name %s already exists. " "Please choose another one or delete existing one then try again.")
                % filename
            )
            return
        # Now do the export
        presentationExport = PresentationExport(self.config, stylesDir, filename)
        presentationExport.export(package)
    except Exception, e:
        client.alert(_("EXPORT FAILED!\n%s") % str(e))
        raise
Example #2
0
def exportPresentation(request, client, filename, stylesDir):
    """
    export client to a DOM presentation
    """

    try:
        # filename is a directory where we will export the website to
        # We assume that the user knows what they are doing
        # and don't check if the directory is already full or not
        # and we just overwrite what's already there
        filename = Path(filename)
        # Append the package name to the folder path if necessary
        if filename.basename() != package.name:
            filename /= package.name
        if not filename.exists():
            filename.makedirs()
        elif not filename.isdir():
            client.alert(
                _(u'Filename %s is a file, cannot replace it') % filename)
            log.error("Couldn't export web page: " +
                      "Filename %s is a file, cannot replace it" % filename)
            return
        else:
            client.alert(
                _(u'Folder name %s already exists. '
                  'Please choose another one or delete existing one then try again.'
                  ) % filename)
            return
        # Now do the export
        presentationExport = PresentationExport(self.config, stylesDir,
                                                filename)
        presentationExport.export(package)
    except Exception, e:
        client.alert(_('EXPORT FAILED!\n%s') % str(e))
        raise
Example #3
0
def exportWebSite(request, client, filename, stylesDir, quick=False):
    """
    Export 'client' to a web site,
    'webDir' is just read from config.webDir
    'stylesDir' is where to copy the style sheet information from
    """
    # filename is a directory where we will export the website to
    filename = Path(filename)
    # Append the package name to the folder path if necessary
    if filename.basename() != package.name:
        filename /= package.name

    if filename.exists() and not quick:
        client.sendScript(
            'askOverwrite("%s", "%s");' % (str(filename).replace("\\", "\\\\"), stylesDir.replace("\\", "\\\\"))
        )
    else:
        # Now do the export
        self.exportWebSite2(client, filename, stylesDir)
Example #4
0
def exportWebSite(request, client, filename, stylesDir, quick=False):
    """
    Export 'client' to a web site,
    'webDir' is just read from config.webDir
    'stylesDir' is where to copy the style sheet information from
    """
    # filename is a directory where we will export the website to
    filename = Path(filename)
    # Append the package name to the folder path if necessary
    if filename.basename() != package.name:
        filename /= package.name

    if filename.exists() and not quick:
        client.sendScript('askOverwrite("%s", "%s");' \
                          % (str(filename).replace("\\", "\\\\"),
                             stylesDir.replace("\\", "\\\\")))
    else:
        # Now do the export
        self.exportWebSite2(client, filename, stylesDir)
Example #5
0
def exportSinglePage(request, client, filename, webDir, stylesDir, \
                     printFlag):
    """
    Export 'client' to a single web page,
    'webDir' is just read from config.webDir
    'stylesDir' is where to copy the style sheet information from
    'printFlag' indicates whether or not this is for print 
                (and whatever else that might mean)
    """
    try:
        imagesDir = webDir.joinpath('images')
        scriptsDir = webDir.joinpath('scripts')
        templatesDir = webDir.joinpath('templates')
        # filename is a directory where we will export the website to
        # We assume that the user knows what they are doing
        # and don't check if the directory is already full or not
        # and we just overwrite what's already there
        filename = Path(filename)
        # Append the package name to the folder path if necessary
        if filename.basename() != package.name:
            filename /= package.name
        if not filename.exists():
            filename.makedirs()
        elif not filename.isdir():
            client.alert(
                _(u'Filename %s is a file, cannot replace it') % filename)
            log.error("Couldn't export web page: " +
                      "Filename %s is a file, cannot replace it" % filename)
            return
        else:
            client.alert(
                _(u'Folder name %s already exists. '
                  'Please choose another one or delete existing one then try again.'
                  ) % filename)
            return
        # Now do the export
        singlePageExport = SinglePageExport(stylesDir, filename, \
                                     imagesDir, scriptsDir, templatesDir)
        singlePageExport.export(package, printFlag)
    except Exception, e:
        client.alert(_('SAVE FAILED!\n%s' % str(e)))
        raise
Example #6
0
def exportSinglePage(request, client, filename, webDir, stylesDir, printFlag):
    """
    Export 'client' to a single web page,
    'webDir' is just read from config.webDir
    'stylesDir' is where to copy the style sheet information from
    'printFlag' indicates whether or not this is for print 
                (and whatever else that might mean)
    """
    try:
        imagesDir = webDir.joinpath("images")
        scriptsDir = webDir.joinpath("scripts")
        templatesDir = webDir.joinpath("templates")
        # filename is a directory where we will export the website to
        # We assume that the user knows what they are doing
        # and don't check if the directory is already full or not
        # and we just overwrite what's already there
        filename = Path(filename)
        # Append the package name to the folder path if necessary
        if filename.basename() != package.name:
            filename /= package.name
        if not filename.exists():
            filename.makedirs()
        elif not filename.isdir():
            client.alert(_(u"Filename %s is a file, cannot replace it") % filename)
            log.error("Couldn't export web page: " + "Filename %s is a file, cannot replace it" % filename)
            return
        else:
            client.alert(
                _(u"Folder name %s already exists. " "Please choose another one or delete existing one then try again.")
                % filename
            )
            return
        # Now do the export
        singlePageExport = SinglePageExport(stylesDir, filename, imagesDir, scriptsDir, templatesDir)
        singlePageExport.export(package, printFlag)
    except Exception, e:
        client.alert(_("SAVE FAILED!\n%s" % str(e)))
        raise