예제 #1
0
파일: fields.py 프로젝트: capless/pfunk
 def validate(self, value, key):
     if isinstance(self.foreign_class, str):
         self.foreign_class = import_util(self.foreign_class)
     if value:
         for obj in value:
             if not isinstance(obj,self.foreign_class):
                 raise ValidationException(
                     '{0}: This value ({1}) should be an instance of {2}.'.format(
                         key, obj, self.foreign_class.__name__))
예제 #2
0
 def test_import_util(self):
     klass = import_util('valley.mixins.VariableMixin')
     self.assertEqual('VariableMixin', klass.__name__)
예제 #3
0
파일: fields.py 프로젝트: capless/pfunk
 def get_foreign_class(self):
     if isinstance(self.foreign_class, str):
         return import_util(self.foreign_class)
     return self.foreign_class
예제 #4
0
 def get_enums(self):
     return [
         i.enum for i in self._base_properties.values()
         if isinstance(i, import_util('pfunk.EnumField'))
     ]
예제 #5
0
 def render(self, include_submit=True):
     template = import_util(self._template)
     return template.render(form=self, include_submit=include_submit)