nopaque/app/utils.py

11 lines
246 B
Python
Raw Normal View History

2021-11-30 15:22:16 +00:00
from app import hashids
from werkzeug.routing import BaseConverter
class HashidConverter(BaseConverter):
def to_python(self, value):
return hashids.decode(value)[0]
def to_url(self, value):
return hashids.encode(value)