No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

format.py 943B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. import warnings
  3. from .varchar import DataHandler as VarcharDataHandler
  4. class DataHandler(VarcharDataHandler):
  5. help = 'Automatic string field, designed to use the str % operator to build its content'
  6. base_type = 'char'
  7. ## @brief Build its content with a field list and a format string
  8. # @param format_string str
  9. # @param max_length int : the maximum length of the handled value
  10. # @param field_list list : List of field to use
  11. # @param **kwargs
  12. def __init__(self, format_string, field_list, max_length, **kwargs):
  13. self._field_list = field_list
  14. self._format_string = format_string
  15. super().__init__(internal='automatic', max_length=max_length)
  16. def can_override(self, data_handler):
  17. if not super().can_override(data_handler):
  18. return False
  19. if data_handler.max_length != self.max_length:
  20. return False
  21. return True