>
> class Input(object):
> def __init__(self, name, *validators, **attrs):
> self.name = name
> self.validators = validators
> self.attrs = attrs = AttributeList(attrs)
>
> self.description = attrs.pop('description', name)
> self.value = attrs.pop('value', None)
> self.pre = attrs.pop('pre', "")
> self.post = attrs.pop('post', "")
> self.note = None
>
> self.id = attrs.setdefault('id', self.get_default_id())
>
> if 'class_' in attrs:
> attrs['class'] = attrs['class_']
> del attrs['class_']
>
> def is_hidden(self):
> return False
>
> def get_type(self):
> raise NotImplementedError
>
> def get_default_id(self):
> return self.name
>
> def validate(self, value):
> self.set_value(value)
>
> for v in self.validators:
> if not v.valid(value):
> self.note = v.msg
> return False
> return True
>
> def set_value(self, value):
> self.value = value
>
> def get_value(self):
> return self.value
>
> def render(self):
> attrs = self.attrs.copy()
> attrs['type'] = self.get_type()
> if self.value is not None:
> attrs['value'] = self.value
> attrs['name'] = self.name
> return '<input %s/>' % attrs
>
I am studying web.py, and enjoying its code, but a problem comes to me...
help, please..
We can see that in the render(), self.get_type() is called.
but when we looking into
> def get_type(self):
> raise NotImplementedError
>
It only raise an Error... and I am amazed at it while I can google nothing
about it. :(
I don't know why it works...
who can tell me please?..
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/LRd9vwwDahEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.