| 375 | def __init__(self, *args, **kvargs): |
| 376 | self.form_type = kvargs.pop( 'form_type', 'input' ) |
| 377 | self.form_length = kvargs.pop( 'form_length', None ) |
| 378 | self.form_rows = kvargs.pop( 'form_rows', None ) |
| 379 | self.form_cols = kvargs.pop( 'form_cols', None ) |
| 380 | if self.form_type == 'input': |
| 381 | if self.form_rows: raise NameError('form_rows parameter is not allowed for form_type "input"') |
| 382 | if self.form_cols: raise NameError('form_cols parameter is not allowed for form_type "input"') |
| 383 | elif self.form_type == 'textarea': |
| 384 | if self.form_length: raise NameError('form_length parameter is not allowed for form_type "textarea"') |
| 385 | else: |
| 386 | raise NameError('invalid form_type argument: ' + self.form_type ) |
| 387 | Field.__init__( self, *args, **kvargs ) |
| 388 | |
| 389 | def prepare_field_objs_and_params(self, manipulator, name_prefix): |
| 390 | field_objs, params = Field.prepare_field_objs_and_params(self, manipulator, name_prefix) |
| 391 | if self.form_length: |
| 392 | params['length'] = self.form_length |
| 393 | if self.form_rows: |
| 394 | params['rows'] = self.form_rows |
| 395 | if self.form_cols: |
| 396 | params['cols'] = self.form_cols |
| 397 | return (field_objs, params) |
| 398 | |
| 811 | def __init__(self, *args, **kvargs): |
| 812 | self.form_rows = kvargs.pop( 'form_rows', None ) |
| 813 | self.form_cols = kvargs.pop( 'form_cols', None ) |
| 814 | Field.__init__(self, *args, **kvargs) |
| 815 | |
| 816 | def prepare_field_objs_and_params(self, manipulator, name_prefix): |
| 817 | field_objs, params = Field.prepare_field_objs_and_params(self, manipulator, name_prefix) |
| 818 | if self.form_rows: |
| 819 | params['rows'] = self.form_rows |
| 820 | if self.form_cols: |
| 821 | params['cols'] = self.form_cols |
| 822 | return (field_objs, params) |
| 823 | |