From cfed63e6644aa489939f40a1ceff5b41e847aeca Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Tue, 11 Nov 2008 03:50:12 -0500 Subject: [PATCH] Move CodeError and InvalidInput into invirt.common svn path=/trunk/packages/invirt-web/; revision=1612 --- code/controls.py | 2 +- code/main.py | 3 ++- code/validation.py | 2 +- code/webcommon.py | 20 -------------------- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/code/controls.py b/code/controls.py index d21eb7a..2ef8c9f 100644 --- a/code/controls.py +++ b/code/controls.py @@ -3,7 +3,7 @@ Functions to perform remctls. """ import validation -from webcommon import CodeError, InvalidInput +from invirt.common import CodeError, InvalidInput import random import subprocess import sys diff --git a/code/main.py b/code/main.py index 3c20902..cd37c0e 100755 --- a/code/main.py +++ b/code/main.py @@ -36,12 +36,13 @@ import templates from Cheetah.Template import Template import validation import cache_acls -from webcommon import InvalidInput, CodeError, State +from webcommon import State import controls from getafsgroups import getAfsGroupMembers from invirt import database from invirt.database import Machine, CDROM, session, connect, MachineAccess, Type, Autoinstall from invirt.config import structs as config +from invirt.common import InvalidInput, CodeError def pathSplit(path): if path.startswith('/'): diff --git a/code/validation.py b/code/validation.py index 25031ef..fe6d7c8 100644 --- a/code/validation.py +++ b/code/validation.py @@ -7,7 +7,7 @@ import string import dns.resolver from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall from invirt.config import structs as config -from webcommon import InvalidInput +from invirt.common import InvalidInput MAX_MEMORY_TOTAL = 512 MAX_MEMORY_SINGLE = 256 diff --git a/code/webcommon.py b/code/webcommon.py index 0e3fd1d..2de6524 100644 --- a/code/webcommon.py +++ b/code/webcommon.py @@ -4,26 +4,6 @@ import time from invirt import database from invirt.database import Machine, MachineAccess -class MyException(Exception): - """Base class for my exceptions""" - pass - -class InvalidInput(MyException): - """Exception for user-provided input is invalid but maybe in good faith. - - This would include setting memory to negative (which might be a - typo) but not setting an invalid boot CD (which requires bypassing - the select box). - """ - def __init__(self, err_field, err_value, expl=None): - MyException.__init__(self, expl) - self.err_field = err_field - self.err_value = err_value - -class CodeError(MyException): - """Exception for internal errors or bad faith input.""" - pass - import controls def cachedproperty(func): -- 1.7.9.5