Files for 2.1b1 distribution.
[python/dscho.git] / Lib / encodings / undefined.py
blob7de993cbdeb5b420bacd1ebef892c77b191b63c8
1 """ Python 'undefined' Codec
3 This codec will always raise a ValueError exception when being
4 used. It is intended for use by the site.py file to switch off
5 automatic string to Unicode coercion.
7 Written by Marc-Andre Lemburg (mal@lemburg.com).
9 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
11 """
12 import codecs
14 ### Codec APIs
16 class Codec(codecs.Codec):
18 def encode(self,input,errors='strict'):
19 raise UnicodeError, "undefined encoding"
21 def decode(self,input,errors='strict'):
22 raise UnicodeError, "undefined encoding"
24 class StreamWriter(Codec,codecs.StreamWriter):
25 pass
27 class StreamReader(Codec,codecs.StreamReader):
28 pass
30 ### encodings module API
32 def getregentry():
34 return (Codec().encode,Codec().decode,StreamReader,StreamWriter)