Commit 0df03974 authored by Tim Peters's avatar Tim Peters

Separated Python imports from ZODB imports; put all global imports before

the first function defn.
parent 74848a74
...@@ -56,13 +56,36 @@ Important: The ZODB package must be importable. You may need to adjust ...@@ -56,13 +56,36 @@ Important: The ZODB package must be importable. You may need to adjust
# #
# position to start of input # position to start of input
# while 1: # while 1:
# if end of file: break # if end of file:
# try: copy_transaction # break
# try:
# copy_transaction
# except: # except:
# scan for transaction # scan for transaction
# continue # continue
import sys, os import sys
import os
import getopt
import time
from struct import unpack
from cPickle import loads
try:
import ZODB
except ImportError:
if os.path.exists('ZODB'):
sys.path.append('.')
elif os.path.exists('FileStorage.py'):
sys.path.append('..')
import ZODB
import ZODB.FileStorage
from ZODB.utils import t32, u64
from ZODB.FileStorage import RecordIterator
from persistent.TimeStamp import TimeStamp
def die(mess='', show_docstring=False): def die(mess='', show_docstring=False):
if mess: if mess:
...@@ -71,21 +94,8 @@ def die(mess='', show_docstring=False): ...@@ -71,21 +94,8 @@ def die(mess='', show_docstring=False):
print >> sys.stderr, __doc__ % sys.argv[0] print >> sys.stderr, __doc__ % sys.argv[0]
sys.exit(1) sys.exit(1)
try: import ZODB class ErrorFound(Exception):
except ImportError: pass
if os.path.exists('ZODB'): sys.path.append('.')
elif os.path.exists('FileStorage.py'): sys.path.append('..')
import ZODB
import getopt, ZODB.FileStorage, time
from struct import unpack
from ZODB.utils import t32, u64
from persistent.TimeStamp import TimeStamp
from cPickle import loads
from ZODB.FileStorage import RecordIterator
class ErrorFound(Exception): pass
def error(mess, *args): def error(mess, *args):
raise ErrorFound(mess % args) raise ErrorFound(mess % args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment