当前位置: 首页>>代码示例>>Python>>正文


Python LOGGER.notice方法代码示例

本文整理汇总了Python中nikola.utils.LOGGER.notice方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.notice方法的具体用法?Python LOGGER.notice怎么用?Python LOGGER.notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nikola.utils.LOGGER的用法示例。


在下文中一共展示了LOGGER.notice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _execute

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def _execute(self, options, args):
     """Start test server."""
     out_dir = self.site.config['OUTPUT_FOLDER']
     if not os.path.isdir(out_dir):
         LOGGER.error("Missing '{0}' folder?".format(out_dir))
     else:
         os.chdir(out_dir)
         httpd = HTTPServer((options['address'], options['port']),
                            OurHTTPRequestHandler)
         sa = httpd.socket.getsockname()
         LOGGER.notice("Serving HTTP on {0} port {1} ...".format(*sa))
         httpd.serve_forever()
开发者ID:emilopez,项目名称:nikola,代码行数:14,代码来源:serve.py

示例2: spell_check

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
    def spell_check(self, post, lang):
        """ Check spellings for the given post and given language. """

        try:
            dictionary = enchant.request_dict(lang)
            checker = SpellChecker(lang, filters=[EmailFilter, URLFilter])
            checker.set_text(post.text(lang=lang, strip_html=True))
            words = [error.word for error in checker]
            words = [
                word for word in words if not dictionary.check(word)
            ]
            LOGGER.notice(
                'Mis-spelt words in %s: %s' % (
                    post.fragment_deps(lang), ', '.join(words)
                )
            )

        except enchant.DictNotFoundError:
            LOGGER.notice('No dictionary found for %s' % lang)
开发者ID:ChillarAnand,项目名称:punchagan.muse-amuse.in,代码行数:21,代码来源:spell_check.py

示例3: spell_check

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
    def spell_check(self, post, lang):
        """ Check spellings for the given post and given language. """

        if enchant.dict_exists(lang):
            checker = SpellChecker(lang, filters=[EmailFilter, URLFilter])
            checker.set_text(post.text(lang=lang, strip_html=True))
            words = [error.word for error in checker]
            words = [
                word for word in words if
                self._not_in_other_dictionaries(word, lang)
            ]
            LOGGER.notice(
                'Mis-spelt words in %s: %s' % (
                    post.fragment_deps(lang), ', '.join(words)
                )
            )

        else:
            LOGGER.notice('No dictionary found for %s' % lang)
开发者ID:ChillarAnand,项目名称:plugins,代码行数:21,代码来源:spell_check.py

示例4: _execute

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
    def _execute(self, command, args):
        # Get last succesful deploy date
        timestamp_path = os.path.join(self.site.config['CACHE_FOLDER'], 'lastdeploy')
        if self.site.config['COMMENT_SYSTEM_ID'] == 'nikolademo':
            LOGGER.warn("\nWARNING WARNING WARNING WARNING\n"
                        "You are deploying using the nikolademo Disqus account.\n"
                        "That means you will not be able to moderate the comments in your own site.\n"
                        "And is probably not what you want to do.\n"
                        "Think about it for 5 seconds, I'll wait :-)\n\n")
            time.sleep(5)

        deploy_drafts = self.site.config.get('DEPLOY_DRAFTS', True)
        deploy_future = self.site.config.get('DEPLOY_FUTURE', False)
        if not (deploy_drafts and deploy_future):
            # Remove drafts and future posts
            out_dir = self.site.config['OUTPUT_FOLDER']
            self.site.scan_posts()
            for post in self.site.timeline:
                if (not deploy_drafts and post.is_draft) or \
                   (not deploy_future and post.publish_later):
                    remove_file(os.path.join(out_dir, post.destination_path()))
                    remove_file(os.path.join(out_dir, post.source_path))

        for command in self.site.config['DEPLOY_COMMANDS']:
            try:
                with open(timestamp_path, 'rb') as inf:
                    last_deploy = literal_eval(inf.read().strip())
            except Exception:
                last_deploy = datetime(1970, 1, 1)  # NOQA

            LOGGER.notice("==>", command)
            ret = subprocess.check_call(command, shell=True)
            if ret != 0:  # failed deployment
                raise Exception("Failed deployment")
        LOGGER.notice("Successful deployment")
        new_deploy = datetime.now()
        # Store timestamp of successful deployment
        with codecs.open(timestamp_path, 'wb+', 'utf8') as outf:
            outf.write(repr(new_deploy))
开发者ID:verbalshadow,项目名称:nikola,代码行数:41,代码来源:deploy.py

示例5: scan_links

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def scan_links(self, find_sources=False):
     LOGGER.notice("Checking Links:")
     LOGGER.notice("===============")
     failure = False
     for task in os.popen('nikola list --all', 'r').readlines():
         task = task.strip()
         if task.split(':')[0] in (
                 'render_tags', 'render_archive',
                 'render_galleries', 'render_indexes',
                 'render_pages'
                 'render_site') and '.html' in task:
             if self.analyze(task, find_sources):
                 failure = True
     if not failure:
         LOGGER.notice("All links checked.")
     return failure
开发者ID:emilopez,项目名称:nikola,代码行数:18,代码来源:check.py

示例6: _execute

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
    def _execute(self, options={}, args=None):
        """Create a new site."""
        if not args:
            print("Usage: nikola init folder [options]")
            return False
        target = args[0]
        if target is None:
            print(self.usage)
        else:
            if not options or not options.get('demo'):
                self.create_empty_site(target)
                LOGGER.notice('Created empty site at {0}.'.format(target))
            else:
                self.copy_sample_site(target)
                LOGGER.notice("A new site with example data has been created at "
                              "{0}.".format(target))
                LOGGER.notice("See README.txt in that folder for more information.")

            self.create_configuration(target)
开发者ID:verbalshadow,项目名称:nikola,代码行数:21,代码来源:init.py

示例7: scan_files

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def scan_files(self):
     failure = False
     LOGGER.notice("Checking Files:")
     LOGGER.notice("===============\n")
     only_on_output, only_on_input = self.real_scan_files()
     if only_on_output:
         only_on_output.sort()
         LOGGER.warn("Files from unknown origins:")
         for f in only_on_output:
             LOGGER.warn(f)
         failure = True
     if only_on_input:
         only_on_input.sort()
         LOGGER.warn("Files not generated:")
         for f in only_on_input:
             LOGGER.warn(f)
     if not failure:
         LOGGER.notice("All files checked.")
     return failure
开发者ID:emilopez,项目名称:nikola,代码行数:21,代码来源:check.py

示例8: setUpClass

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def setUpClass():
     LOGGER.notice('--- TESTS FOR ItemScope')
     LOGGER.level = logbook.WARNING
开发者ID:bronsen,项目名称:plugins,代码行数:5,代码来源:test_microdata.py

示例9: tearDownClass

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def tearDownClass():
     sys.stdout.write('\n')
     LOGGER.level = logbook.NOTICE
     LOGGER.notice('--- END OF TESTS FOR ItemPropUrl')
开发者ID:bronsen,项目名称:plugins,代码行数:6,代码来源:test_microdata.py

示例10: tearDownClass

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def tearDownClass():
     sys.stdout.write('\n')
     #LOGGER.level = logbook.NOTICE
     LOGGER.notice('--- END OF TESTS FOR helloworld')
开发者ID:ifosch,项目名称:plugins,代码行数:6,代码来源:test_helloworld.py

示例11: setUpClass

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def setUpClass():
     from nikola.__main__ import main
     main(['install_plugin', 'microdata'])
     LOGGER.notice('--- TESTS FOR ItemScope')
     LOGGER.level = logbook.WARNING
开发者ID:michaeljoseph,项目名称:nikola-plugins,代码行数:7,代码来源:test_microdata.py

示例12: generate_css

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
        def generate_css():
            # Compass compile
            for theme_name in self.site.THEMES:

                theme_root = os.path.abspath(utils.get_theme_path(theme_name))
                compass_root = os.path.abspath(os.path.join(theme_root, 'style'))
                tmp_dir = os.path.abspath(os.path.join(theme_root, '_tmp'))

                if os.path.exists(compass_root):

                    LOGGER.notice("PYGMENTS CSS CODE")
                    create_code_css(self.site.config['CODE_COLOR_SCHEME'],
                                    os.path.join(compass_root, 'css', 'code.css'))


                    LOGGER.notice("COMPASS COMPILE")
                    run('compass clean', cwd=compass_root)
                    run('compass compile', cwd=compass_root)

                    LOGGER.notice("AUTOPREFIXER")
                    LOGGER.notice("CWD: {}".format(theme_root))
                    run('autoprefixer -o _tmp/all.pre.css _tmp/all.css', cwd=theme_root)

                    LOGGER.notice("CSSO (CSS optimizer)")
                    LOGGER.notice("CWD: {}".format(theme_root))
                    run('csso _tmp/all.pre.css _tmp/all.min.css', cwd=theme_root)


                    LOGGER.notice("Move CSS to output")
                    css_output_dir = os.path.join(os.path.abspath(self.site.config['OUTPUT_FOLDER']), 'assets', 'css')
                    utils.makedirs(css_output_dir)
                    shutil.copy2(os.path.join(tmp_dir, 'all.min.css'), css_output_dir)
开发者ID:jlesquembre,项目名称:blog,代码行数:34,代码来源:compilecss.py

示例13: update_feed

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def update_feed(feed):
     modified = feed.last_modified.timetuple()
     etag = feed.etag
     try:
         parsed = feedparser.parse(
             feed.url,
             etag=etag,
             modified=modified
         )
         feed.last_status = str(parsed.status)
     except:  # Probably a timeout
         # TODO: log failure
         return
     if parsed.feed.get('title'):
         LOGGER.notice(parsed.feed.title)
     else:
         LOGGER.notice(feed.url)
     feed.etag = parsed.get('etag', 'foo')
     modified = tuple(parsed.get('date_parsed', (1970, 1, 1)))[:6]
     LOGGER.notice("==========>", modified)
     modified = datetime.datetime(*modified)
     feed.last_modified = modified
     feed.save()
     # No point in adding items from missinfg feeds
     if parsed.status > 400:
         # TODO log failure
         return
     for entry_data in parsed.entries:
         LOGGER.notice("=========================================")
         date = entry_data.get('published_parsed', None)
         if date is None:
             date = entry_data.get('updated_parsed', None)
         if date is None:
             LOGGER.error("Can't parse date from:\n", entry_data)
             return False
         LOGGER.notice("DATE:===>", date)
         date = datetime.datetime(*(date[:6]))
         title = "%s: %s" % (feed.name, entry_data.get('title', 'Sin título'))
         content = entry_data.get('content', None)
         if content:
             content = content[0].value
         if not content:
             content = entry_data.get('description', None)
         if not content:
             content = entry_data.get('summary', 'Sin contenido')
         guid = str(entry_data.get('guid', entry_data.link))
         link = entry_data.link
         LOGGER.notice(repr([date, title]))
         e = list(Entry.select().where(Entry.guid == guid))
         LOGGER.notice(
             repr(dict(
                 date=date,
                 title=title,
                 content=content,
                 guid=guid,
                 feed=feed,
                 link=link,
             ))
         )
         if not e:
             entry = Entry.create(
                 date=date,
                 title=title,
                 content=content,
                 guid=guid,
                 feed=feed,
                 link=link,
             )
         else:
             entry = e[0]
             entry.date = date
             entry.title = title
             entry.content = content
             entry.link = link
         entry.save()
开发者ID:emilopez,项目名称:nikola,代码行数:77,代码来源:__init__.py

示例14: tearDownModule

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
def tearDownModule():
    sys.stdout.write('\n')
    LOGGER.level = logbook.NOTICE
    LOGGER.notice('--- END OF TESTS FOR tags')
开发者ID:getnikola,项目名称:plugins,代码行数:6,代码来源:test_command_tags.py

示例15: setUpClass

# 需要导入模块: from nikola.utils import LOGGER [as 别名]
# 或者: from nikola.utils.LOGGER import notice [as 别名]
 def setUpClass():
     LOGGER.notice('--- TESTS FOR helloworld')
开发者ID:ifosch,项目名称:plugins,代码行数:4,代码来源:test_helloworld.py


注:本文中的nikola.utils.LOGGER.notice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。