Hi again, working with the original section, now I have this:

- On a CLIENT computer, I generate the INI file with this structure:
[Room]

name = room1
color = red
size = big

- I send it by FTP to the computer where web2py is running

- I have this script to parse and process the INI files on the server:

import os
import ConfigParser
import traceback

_configDir = "_configuploads"

def parse(filename):
try:
config = ConfigParser.ConfigParser()
print filename
config.read(filename)
rooms = config.sections()
print "Rooms: %s"%rooms
dictio = {}
for room in rooms:
dictio[rom] = {}
options = config.options(room)
print "Ops: %s"%options
for option in options:
dictio[room][option] = config.get(room,option)
print dictio
return 0
except:
print "Something failed!!!!!"
print traceback.format_exc()
return 1

objects = os.listdir(_configDir)

for item in objects:
fitem = os.path.join(os.getcwd(),_configDir,item)
parse(fitem)
print "====================================="

this is a script placed on the root web2py directory (I'm using the source
version on a Windows PC)

So with this script I parse the INI and put the info in to a dictionary
called "dictio", now,  how could I use this dictio info for saving it in the
DB. Keys are generic and standard so they are the fields names. Values are
the Values :P


I'm not expert with python, in fact all above is made with some code of
here, some of there....


Thanks! I hope you can help me!

Reply via email to