Beispiel #1
0
 def hashid(self):
     # A unique identifier for the form that maps to its id,
     # but doesn't seem like a sequential integer
     try:
         return self._hashid
     except AttributeError:
         if not self.id:
             raise Exception("this form doesn't have an id yet, commit it first.")
         self._hashid = HASHIDS_CODEC.encode(self.id)
     return self._hashid
Beispiel #2
0
 def hashid(self):
     # A unique identifier for the form that maps to its id,
     # but doesn't seem like a sequential integer
     try:
         return self._hashid
     except AttributeError:
         if not self.id:
             raise Exception("this form doesn't have an id yet, commit it first.")
         self._hashid = HASHIDS_CODEC.encode(self.id)
     return self._hashid
Beispiel #3
0
 def get_with_hashid(cls, hashid):
     id = HASHIDS_CODEC.decode(hashid)[0]
     return cls.query.get(id)
Beispiel #4
0
 def get_with_hashid(cls, hashid):
     try:
         id = HASHIDS_CODEC.decode(hashid)[0]
         return cls.query.get(id)
     except IndexError:
         return None
Beispiel #5
0
 def get_with_hashid(cls, hashid):
     try:
         id = HASHIDS_CODEC.decode(hashid)[0]
         return cls.query.get(id)
     except IndexError:
         return None
Beispiel #6
0
 def get_form_by_random_like_string(cls, random_like_string):
     id = HASHIDS_CODEC.decode(random_like_string)[0]
     return cls.query.get(id)
Beispiel #7
0
 def get_random_like_string(self):
     if not self.id:
         raise Exception(
             "this form doesn't have an id yet, commit it first.")
     return HASHIDS_CODEC.encode(self.id)
Beispiel #8
0
 def get_with_hashid(cls, hashid):
     id = HASHIDS_CODEC.decode(hashid)[0]
     return cls.query.get(id)
Beispiel #9
0
 def get_random_like_string(self):
     if not self.id:
         raise Exception("this form doesn't have an id yet, commit it first.")
     return HASHIDS_CODEC.encode(self.id)