Consider this code: #Create a database:
import metakit db = metakit.storage("passwordfile.mk",1) #Create a view (this is the Metakit term for "table"): vw = db.getas("users[username:S,password:S]") #get user name to add user = raw_input('User Name to Add: ') # check and see if it exists in datafile already c_vw = vw.select(username=user) if c_vw: for r in c_vw: ix = vw.find(username=user, start=2) #=================>>>>wanted to get row index here, is broken print r.username + ' already exists in database at: ', ix else: # get a password for the new user passw = raw_input('Password for that user: ') #Add a row (this is the Metakit term for "record"): idx = vw.append(username=user,password=passw) print 'Base0 index position where record was inserted: ' + str(idx) #Commit the changes to file: db.commit() #Show a list of all users for r in vw: print r.username, r.password
#==============>>>>>>>>>>>>>>>>>>>>>>END SCRIPT I have been through all the documentation that I could find, and was unable
to find out how to get the row index.
Could someone give a push in the right direction?? TIA :-) _____________________________________________ Metakit mailing list - Metakit@equi4.com http://www.equi4.com/mailman/listinfo/metakit