コード例 #1
0
    def _is_site_root(self, path):
        """Check if the path provided is the handroll site's root."""
        # It looks like a site root if it has the config file.
        if os.path.exists(os.path.join(path, self.CONFIG)):
            return True
        # It looks like a site root if it has templates.
        elif template.has_templates(path):
            return True

        return False
コード例 #2
0
ファイル: site.py プロジェクト: iter8ve/handroll
    def _is_site_root(self, path):
        """Check if the path provided is the handroll site's root."""
        # It looks like a site root if it has the config file.
        if os.path.exists(os.path.join(path, self.CONFIG)):
            return True
        # It looks like a site root if it has templates.
        elif template.has_templates(path):
            return True

        return False
コード例 #3
0
    def test_has_templates_directory(self):
        site = tempfile.mkdtemp()
        os.mkdir(os.path.join(site, 'templates'))

        self.assertTrue(template.has_templates(site))
コード例 #4
0
    def test_has_default_template(self):
        site = tempfile.mkdtemp()
        open(os.path.join(site, 'template.html'), 'w').close()

        self.assertTrue(template.has_templates(site))