[XML-SIG] Specializing DOM exceptions
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Sat, 23 Dec 2000 12:23:14 +0100
> > To Ft/Dom/__init__.py and expected everything to break, but all
> > was well. It seems that at least Python 2.0 is clever when the
> > same import can be made as a package and an object. Is this also
> > the casde with Python 1.5.2?
>
> I tried that with python 1.5.2 (adding a empty Node class to
> xml/dom/__init__.py) and it looks like it's fine too.
Actually, there is a problem. If you do "import xml.dom.Node", then
you'll loose the class from __init__. Please see the attached example.
So I think the change of adding xml.dom.Node needs to be reverted
somehow.
Regards
Martin
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2000-12-23 12:22 CET by <martin@mira>.
# Source directory was `/home/martin/tmp/x'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 19 -rw-r--r-- pack/__init__.py
# 19 -rw-r--r-- pack/A.py
# 61 -rw-r--r-- testing.py
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh01060; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= pack/__init__.py ==============
if test ! -d 'pack'; then
$echo 'x -' 'creating directory' 'pack'
mkdir 'pack'
fi
if test -f 'pack/__init__.py' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pack/__init__.py' '(file already exists)'
else
$echo 'x -' extracting 'pack/__init__.py' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pack/__init__.py' &&
class A:
X val = 3
SHAR_EOF
$shar_touch -am 12231215100 'pack/__init__.py' &&
chmod 0644 'pack/__init__.py' ||
$echo 'restore of' 'pack/__init__.py' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pack/__init__.py:' 'MD5 check failed'
d0e22baa34ce648d02a5985bb626ca97 pack/__init__.py
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pack/__init__.py'`"
test 19 -eq "$shar_count" ||
$echo 'pack/__init__.py:' 'original size' '19,' 'current size' "$shar_count!"
fi
fi
# ============= pack/A.py ==============
if test -f 'pack/A.py' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pack/A.py' '(file already exists)'
else
$echo 'x -' extracting 'pack/A.py' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pack/A.py' &&
class B:
X val = 4
SHAR_EOF
$shar_touch -am 12231215100 'pack/A.py' &&
chmod 0644 'pack/A.py' ||
$echo 'restore of' 'pack/A.py' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pack/A.py:' 'MD5 check failed'
7c0bf0114ca239435403d33f3c475cb3 pack/A.py
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pack/A.py'`"
test 19 -eq "$shar_count" ||
$echo 'pack/A.py:' 'original size' '19,' 'current size' "$shar_count!"
fi
fi
# ============= testing.py ==============
if test -f 'testing.py' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'testing.py' '(file already exists)'
else
$echo 'x -' extracting 'testing.py' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing.py' &&
import pack
print pack.A.val
import pack.A
print pack.A.val
X
SHAR_EOF
$shar_touch -am 12231216100 'testing.py' &&
chmod 0644 'testing.py' ||
$echo 'restore of' 'testing.py' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'testing.py:' 'MD5 check failed'
045d5a097b0968507fce45f10d00c5b2 testing.py
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'testing.py'`"
test 61 -eq "$shar_count" ||
$echo 'testing.py:' 'original size' '61,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh01060
exit 0