예제 #1
0
def test_hashids_decode_one():
    assert hashids.decode_one("foo", "1V91V4") == 1
    assert hashids.decode_one("bar", "E8Rz8D") == 1
    assert hashids.decode_one("foo", "Lgq4nK") == 123
    assert hashids.decode_one("foo", "zvuvt2") is None
예제 #2
0
 def get_by_hashid(cls, hashid):
     """Return the group with the given hashid, or None."""
     return cls.get_by_id(hashids.decode_one('h.groups', hashid))