def save(self): if not self.slug: self.slug = slugify(self.name) super(GitRepoRepository, self).save() repodir = self.get_dir() if not self.fs.exists(repodir): self.fs.mkdir(repodir) self.fs.pushd(repodir) self._run_sync('git init --bare') self.fs.popd()
def create_repository(self, name, description): GitRepository = meta.get_model('GitRepository') title = unicode(name) repo = GitRepository.create( name=title, slug=slugify(title), description=unicode(description), owner=self ) return repo
def test_full_accents(self): "slugify should be able to slugify a much accented sentence" original = "Ação é bordô à síri tãmisa" got = slugify(original) assert_equals(got, "acao-e-bordo-a-siri-tamisa")
def test_special_chars(self): "slugify should remove any special chars" original = "here!@#$%*-()_+and{}[]-~^`'´/?\|there" got = slugify(original) assert_equals(got, "here-and-there")
def test_my_name(self): "slugify should be able to slugify my name :)" original = "Gabriel Falcão" got = slugify(original) assert_equals(got, "gabriel-falcao")
def test_simple_spaces(self): "slugify should replace blank spaces with a dash" original = "simple string with spaces" assert_equals(slugify(original), "simple-string-with-spaces")