#!/usr/bin/python

import sys
import gdbm
import cvsdb
import posix
import string
import shelve

from Config import *
import Utils
import Users
import Actions

def getline():
	return string.strip(sys.stdin.readline())

print 'Please enter the input GDBM file to use: ',
inputfile = getline()
#inputfile = '/home/httpd/html/vetinari/pyledb'

indb = shelve.BsdDbShelf(gdbm.open(inputfile, 'r'))

cvsdb.no_cvs_debug = 0

for k in indb.keys():
	ent = indb[k]
	print k + ':'
	for kk in ent.keys():
		print '  ' + k + '.' + kk

		if kk == 'attachments':
			atts = ent[kk]
			for name in atts.keys():
				att = atts[name]
				att.pagename = k
				att.setcontent(att.content)
				del att.content

		Utils.dbset(k, kk, ent[kk])
