Changeset 1612 for trunk/packages


Ignore:
Timestamp:
Nov 11, 2008, 3:50:12 AM (16 years ago)
Author:
broder
Message:

Move CodeError? and InvalidInput? into invirt.common

Location:
trunk/packages
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-base/debian/changelog

    r1609 r1612  
     1invirt-base (0.0.9) unstable; urgency=low
     2
     3  * Move useful Python exceptions into invirt.common
     4
     5 -- Evan Broder <broder@mit.edu>  Tue, 11 Nov 2008 00:32:19 -0500
     6
    17invirt-base (0.0.8) unstable; urgency=low
    28
  • trunk/packages/invirt-base/python/invirt/common.py

    r1330 r1612  
    3838
    3939#
     40# Exceptions.
     41#
     42
     43class InvalidInput(Exception):
     44    """Exception for user-provided input is invalid but maybe in good faith.
     45
     46    This would include setting memory to negative (which might be a
     47    typo) but not setting an invalid boot CD (which requires bypassing
     48    the select box).
     49    """
     50    def __init__(self, err_field, err_value, expl=None):
     51        MyException.__init__(self, expl)
     52        self.err_field = err_field
     53        self.err_value = err_value
     54
     55class CodeError(Exception):
     56    """Exception for internal errors or bad faith input."""
     57    pass
     58
     59#
    4060# Tests.
    4161#
  • trunk/packages/invirt-web/code/controls.py

    r1318 r1612  
    44
    55import validation
    6 from webcommon import CodeError, InvalidInput
     6from invirt.common import CodeError, InvalidInput
    77import random
    88import subprocess
  • trunk/packages/invirt-web/code/main.py

    r1578 r1612  
    3737import validation
    3838import cache_acls
    39 from webcommon import InvalidInput, CodeError, State
     39from webcommon import State
    4040import controls
    4141from getafsgroups import getAfsGroupMembers
     
    4343from invirt.database import Machine, CDROM, session, connect, MachineAccess, Type, Autoinstall
    4444from invirt.config import structs as config
     45from invirt.common import InvalidInput, CodeError
    4546
    4647def pathSplit(path):
  • trunk/packages/invirt-web/code/validation.py

    r1542 r1612  
    88from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall
    99from invirt.config import structs as config
    10 from webcommon import InvalidInput
     10from invirt.common import InvalidInput
    1111
    1212MAX_MEMORY_TOTAL = 512
  • trunk/packages/invirt-web/code/webcommon.py

    r1318 r1612  
    44from invirt import database
    55from invirt.database import Machine, MachineAccess
    6 
    7 class MyException(Exception):
    8     """Base class for my exceptions"""
    9     pass
    10 
    11 class InvalidInput(MyException):
    12     """Exception for user-provided input is invalid but maybe in good faith.
    13 
    14     This would include setting memory to negative (which might be a
    15     typo) but not setting an invalid boot CD (which requires bypassing
    16     the select box).
    17     """
    18     def __init__(self, err_field, err_value, expl=None):
    19         MyException.__init__(self, expl)
    20         self.err_field = err_field
    21         self.err_value = err_value
    22 
    23 class CodeError(MyException):
    24     """Exception for internal errors or bad faith input."""
    25     pass
    266
    277import controls
Note: See TracChangeset for help on using the changeset viewer.