Example #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
Example #2
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
Example #3
0
    def test_has_templates_directory(self):
        site = tempfile.mkdtemp()
        os.mkdir(os.path.join(site, 'templates'))

        self.assertTrue(template.has_templates(site))
Example #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))