Exemple #1
0
def _before_first_request():
    global LAST_UPDATE
    try:
        LAST_UPDATE = PATH.LAST_UPDATE.read(encoding='utf8')
    except FileNotFoundError:
        LAST_UPDATE = date_from_timestamp()

    global IS_DEV
    # Todo activate condition when main dev phase is over
    IS_DEV = True  # 'FREEZER_DESTINATION' not in app.config
    global IS_FREEZING
    IS_FREEZING = "FREEZER_DESTINATION" in app.config
    NAV.populate()
Exemple #2
0
Fichier : cli.py Projet : ADFD/adfd
 def freeze(cls):
     buildPath = tempfile.mkdtemp()
     app.config.update(
         FREEZER_DESTINATION=PATH.RENDERED,
         FREEZER_RELATIVE_URLS=True,
         FREEZER_REMOVE_EXTRA_FILES=True,
         FREEZER_DESTINATION_IGNORE=['.git*', '*.idea'])
     freezer = Freezer(app)
     freezer.register_generator(fridge.path_route)
     with local.cwd(PATH.PROJECT):
         log.info("freezing %s", freezer)
         with open(PATH.LAST_UPDATE, 'w', encoding='utf') as f:
             f.write(date_from_timestamp())
         seenUrls = freezer.freeze()
         log.info("frozen urls are:\n%s", '\n'.join(seenUrls))
     cls.copytree(buildPath, PATH.RENDERED)
     cls.deliver_static_root_files()
     cls.remove_clutter()
     cls.write_bbcode_sources()
     if not INFO.IS_DEV_BOX:
         AdfdFixStagingPaths.fix_staging_paths()
     print("ADFD site successfully frozen!")
Exemple #3
0
 def lastUpdate(self):
     newestDate = sorted([p.postTime for p in self._posts], reverse=True)[0]
     return date_from_timestamp(newestDate)
Exemple #4
0
 def creationDate(self):
     return date_from_timestamp(self._firstPost.postTime)