All pastes #470742 Raw Edit

widgets.py

public python v1 · immutable
·published 2007-05-04 13:54 UTC
rendered paste body
############################################ Package: ship.computer.browser       #### File: widgets.py                     #### Author: Aaron Cripps                 #### Student Number: 200517613            #### Email: acripps -~at~- gmail.com      ################################################################## Import Section ######################from zope.app.form.browser.textwidgets import TextWidgetfrom ship.computer.browser.exceptions import InvalidOctetException###################################### IPAddressWidget Implementation ##class IPAddressWidget(TextWidget):    """This class is currently a stub."""    def _toFieldValue(self, input):        input = super(TextWidget, self)._toFieldValue(input)        return input    def _validate(self, value):        super(TextLine, self)._validate(value)        value = value.split('.')        for i in value:            i = i.strip('.')        for i in value:            if int(i)>255:                raise InvalidOctetException            ####################################### MACAddressWidget Implementation ##class MACAddressWidget:    """Blank. This class is currently a stub."""    pass