Ejemplo n.º 1
0
 def _runTest_(self, expectedResult, configFile=None):
     if (configFile is None):
         conf = os.path.join(self.site.getSiteDir(), "test.config")
     else:
         conf = configFile
     update = updateSite.UpdateSite(conf, None, ui=SiteUtils.SilentUI())
     update.buildSite()
     comp = SiteUtils.DirCompare()
     res = comp.compare(self.site.getDestDir(), expectedResult)
     self.failUnless(res is None, res)
Ejemplo n.º 2
0
	def _runTest_ (self, expectedResult, classes=None):
		if (classes is not None):
			config = {'classes': classes}
		else:
			config = {}
		conf = os.path.join (self.site.getSiteDir(), "test.config")
		update = updateSite.UpdateSite (conf, None, options=config, ui=SiteUtils.SilentUI())
		update.buildSite()
		comp = SiteUtils.DirCompare()
		res = comp.compare (self.site.getDestDir(), expectedResult)
		self.failUnless (res is None, res)
Ejemplo n.º 3
0
 def __init__(self,
              configFile,
              path=None,
              options={},
              ui=SiteUtils.UserInteraction()):
     self.ui = ui
     self.config = SiteConfiguration.SiteConfig(configFile)
     self.pageBuilder = SiteUtils.PageBuilder(self.config, self.ui)
     self.options = options
     self.target = path
     self.log = logging.getLogger("UpdateSite")
     self.publisher = SitePublisher.PagePublisher(self.config, self.ui)
Ejemplo n.º 4
0
def main(args):
    try:
        opts, args = getopt.getopt(args, "ha", [
            "help", "all", "force", "uptodate", "dry-run", "logging",
            "logfile=", "debug", "debug-simpletal"
        ])
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    if (len(args) == 0):
        usage()
        sys.exit(2)

    options = {}
    enableLogging = 0
    pubtalLogging = logging.INFO
    simpletalLogging = logging.INFO
    logFile = "uploadSite.log"
    for opt, arg in opts:
        if (opt == '-h' or opt == '--help'):
            usage()
            sys.exit(0)
        elif (opt == '-a' or opt == '--all'):
            options['allFiles'] = 1
        elif (opt == "--logging"):
            enableLogging = 1
        elif (opt == "--logfile"):
            logFile = arg
        elif (opt == '--force'):
            options['forceUpload'] = 1
        elif (opt == '--uptodate'):
            options['markFilesUpToDate'] = 1
        elif (opt == '--dry-run'):
            options['dry-run'] = 1
        elif (opt == '--debug'):
            pubtalLogging = logging.DEBUG
            enableLogging = 1

    if (LOGGING_EXISTS):
        root = logging.getLogger()
        if (enableLogging):
            handler = logging.FileHandler(logFile)
            root.addHandler(handler)
            handler.setFormatter(
                logging.Formatter(
                    '%(asctime)s %(levelname)s  %(name)s - %(message)s'))
            root.setLevel(pubtalLogging)
            talLogger = logging.getLogger("simpleTAL")
            talLogger.setLevel(simpletalLogging)
            talesLogger = logging.getLogger("simpleTALES")
            talesLogger.setLevel(simpletalLogging)
        else:
            root.addHandler(logging.StreamHandler())
            root.addFilter(SiteUtils.BlockFilter())
            logging.disable(logging.CRITICAL)

    update = UploadSite(args[0])
    update.uploadSite(args[1:], options)
Ejemplo n.º 5
0
 def setUp(self):
     self.site = SiteUtils.SiteBuilder()
     self.site.buildDirs()
Ejemplo n.º 6
0
def main(args):
    try:
        opts, leftargs = getopt.getopt(args, "ha", [
            "help", "all", "class=", "logging", "logfile=", "debug",
            "debug-simpletal"
        ])
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    if (len(args) == 0):
        usage()
        sys.exit(2)

    enableLogging = 0
    options = {}
    pubtalLogging = logging.INFO
    simpletalLogging = logging.INFO
    logFile = "updateSite.log"
    for opt, arg in opts:
        if (opt == '-h' or opt == '--help'):
            usage()
            sys.exit(0)
        elif (opt == "--all" or opt == "-a"):
            options['buildAllClasses'] = 1
        elif (opt == "--class"):
            options['classes'] = arg
        elif (opt == "--logging"):
            enableLogging = 1
        elif (opt == "--logfile"):
            logFile = arg
        elif (opt == '--debug'):
            pubtalLogging = logging.DEBUG
            enableLogging = 1
        elif (opt == '--debug-simpletal'):
            simpletalLogging = logging.DEBUG
            enableLogging = 1

    if (LOGGING_EXISTS):
        root = logging.getLogger()
        if (enableLogging):
            handler = logging.FileHandler(logFile)
            root.addHandler(handler)
            handler.setFormatter(
                logging.Formatter(
                    '%(asctime)s %(levelname)s  %(name)s - %(message)s'))
            root.setLevel(pubtalLogging)
            talLogger = logging.getLogger("simpleTAL")
            talLogger.setLevel(simpletalLogging)
            talesLogger = logging.getLogger("simpleTALES")
            talesLogger.setLevel(simpletalLogging)
        else:
            root.addHandler(logging.StreamHandler())
            root.addFilter(SiteUtils.BlockFilter())
            logging.disable(logging.CRITICAL)

    if (len(leftargs) == 0):
        usage()
        sys.exit(1)
    elif (len(leftargs) == 1):
        update = UpdateSite(leftargs[0], path=None, options=options)
    else:
        update = UpdateSite(leftargs[0], path=leftargs[1:], options=options)
    update.buildSite()
Ejemplo n.º 7
0
 def __init__(self, configFile, ui=SiteUtils.UserInteraction()):
     self.config = SiteConfiguration.SiteConfig(configFile)
     self.uploader = SiteUploader.SiteUploader(self.config)
     self.log = logging.getLogger("UploadSite")
     self.ui = ui