Skip to content

Commit

Permalink
Merged in Frozenball/alembic/longer-filenames (pull request #12)
Browse files Browse the repository at this point in the history
Change filename length restriction to 60 characters & word truncation
  • Loading branch information
Mike Bayer committed Nov 26, 2013
2 parents 83d0b8c + 71b6361 commit 8dc63a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion alembic/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ def _revision_map(self):
return map_

def _rev_path(self, rev_id, message, create_date):
slug = "_".join(_slug_re.findall(message or "")).lower()[0:20]
slug = "_".join(_slug_re.findall(message or "")).lower()
if len(slug) > 60:
slug = slug[:60].rsplit('_', 1)[0]+'_'
filename = "%s.py" % (
self.file_template % {
'rev': rev_id,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_revision_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def test_008_long_name(self):
"I'd like it to\nhave\nnewlines")
assert os.access(
os.path.join(env.dir, 'versions',
'%s_this_is_a_really_lon.py' % rid), os.F_OK)
'%s_this_is_a_really_long_name_with_lots_of_'
'characters_and_also_.py' % rid), os.F_OK)


@classmethod
Expand Down

0 comments on commit 8dc63a0

Please sign in to comment.