Use proper path converter for lemonshort

This commit is contained in:
Danielle McLean 2022-03-12 15:04:05 +11:00
parent cfeb206154
commit 683adc1b46
5 changed files with 20 additions and 14 deletions

View file

@ -6,10 +6,11 @@ from string import ascii_lowercase, ascii_uppercase
chars = ascii_uppercase + ascii_lowercase
conv = BaseConverter(chars)
class AbcIdConverter:
regex = '[a-zA-Z]+'
def abc_to_id(abc):
return int(conv.decode(abc))
def to_python(self, value: str) -> int:
return int(conv.decode(value))
def id_to_abc(id):
return conv.encode(id)
def to_url(self, value: int) -> str:
return conv.encode(value)