def validate_bname(self, bname):
     brand = find_first_query(engine, bname.data, "bname", "brands")
     if brand is not None:
         raise ValidationError('Please use a different name.')
 def validate_comment(self, comment):
     user = find_first_query(engine, comment.data, "content", "communities")
     if user is not None:
         raise ValidationError('Please say something different.')
 def validate_bid(self, bid):
     brand = find_first_query(engine, bid.data, "bid", "brands")
     if brand is not None:
         raise ValidationError('Please use a different ID.')
 def validate_cname(self, cname):
     user = find_first_query(engine, cname.data, "cname", "customers")
     if user is not None:
         raise ValidationError('Please use a different username.')
 def validate_cateid(self, cateid):
     cate = find_first_query(engine, cateid.data, "cateid", "categories")
     if cate is not None:
         raise ValidationError('No such category found!')
 def validate_bid(self, bid):
     brand = find_first_query(engine, bid.data, "bid", "brands")
     if brand is None:
         raise ValidationError('No such company found!')
 def validate_pname(self, pname):
     product = find_first_query(engine, pname.data, "pname", "products")
     if product is not None:
         raise ValidationError('Please use a different name.')
 def validate_pid(self, pid):
     product = find_first_query(engine, pid.data, "pid", "products")
     if product is not None:
         raise ValidationError('Please use a different ID.')