Exception or not
Suppose you have some HTML forms which you would like to validate. Every field can have different errors. For example, this are the forms: username password etc And you want to validate them with some class. Is this good pattern: class Foo(object): def validateUsername(username): if username isn't correct: raise ValidationError() def validatePassword(password): if password isn't correct: raise ValidationError() code: try: usernameError = validateUsername() except ValidationError: usernameError = error from exception try: passwordError = validatePassword() except ValidationError: passwordError = error from exception So, if there wasn't any errors, usernameError and passwordError both contains None, and there was error, both contains some string? Should I use exception or just return None or some string without exception? -- http://mail.python.org/mailman/listinfo/python-list
Unit testing Web applications
Hi! Does Python has some testing frameworks for testing Web applications (like Cactus and HttpUnit for Java), generating requests and checking if the response is correct? -- http://mail.python.org/mailman/listinfo/python-list
Write bits in file
Hi I have a specific format and I need binary representation. Does Python have some built-in function which will, for instance, represent number 15 in exactly 10 bits? -- http://mail.python.org/mailman/listinfo/python-list
Re: Write bits in file
On May 18, 2:20 pm, Ken Starks <[EMAIL PROTECTED]> wrote: > You want your file considered as a sequence of bits rather > than a sequence of 8-bit bytes, do you? Yes. > is the 10-bit > bit-pattern to be stored at an arbitrary bit-position in > the file Yes. I need arbitrary, 8bits, than 10 bits for something else, than sequence of bytes, than 10 bits again, etc. -- http://mail.python.org/mailman/listinfo/python-list