########################################## ## Package: ship.computer.browser ## ## File: widgets.py ## ## Author: Aaron Cripps ## ## Student Number: 200517613 ## ## Email: acripps -~at~- gmail.com ## ########################################## #################### ## Import Section ## #################### import re from zope.app.form.browser.textwidgets import TextWidget from 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