On Jan 21, 9:21 am, Dave Angel wrote:

> Put it inside a dummy class, as follows:

This has been very educational, thank you for all the suggestions.
Here is the resulting code:


class Property: pass # example of a dummy class
Plist = Property() # create a Plist object from the dummy class

# accumulate dictionary attributes based on every plist file
dataFolder=os.path.dirname(__file__)+'/Data/'
plistFiles=glob.glob(dataFolder+'*.plist')

for file in range(len(plistFiles)):
        name=plistFiles[file].replace(dataFolder,'').replace('.plist','')
        setattr(Plist, name, Dict(plistFiles[file]).Config) # load the Plist
object with the dictionary



This is a vast improvement over my previous system. Now I can call any
plist item from anywhere on my website:

Data.Plist.Site.Trace

where "Site.plist" is the name of the Plist file. This is such an
elegant system I'm surprised it is not implemented as part of Python.

-- Gnarlie
http://Gnarlodious.com/Gnarlodious
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to