All pastes #470739 Raw Copy code Copy link Edit

widgets.py

public python v1 · immutable
#470739 ·published 2007-05-04 13:51 UTC
rendered paste body
############################################ Package: ship.computer.browser       #### File: widgets.py                     #### Author: Aaron Cripps                 #### Student Number: 200517613            #### Email: acripps -~at~- gmail.com      ################################################################## Import Section ######################import refrom 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