I am relatively new to django nad i was wondeirng if anyone knew how
to open and read the files taht have been uploaded to the site. I have
tried the following code in the save method of my filefield model. The
problem is that you have to save the file to the system and then try
to manipulate it, but when i try to call the open function on the
parser i get an error stating that
'module' object cannot be called
so i am stuck, here is the code and thanks to anyone who takes the
time to respond to me
def save(self):
super(BulkDataRegFiles, self).save()
import ConfigParser
config=ConfigParser.ConfigParser()
config.readfp(open('%s' % (self.bulk_file)))
sec=config.sections()
for i in sec:
set_name = i
it = config.items(i)
for k in it:
tag = k[0]
if tag == 'url':
url = k[1]
elif tag == 'type':
type1 = k[1]
elif tag == 'end_date':
end = k[1]
elif tag == 'start_date':
start = k[1]
elif tag == 'metadata':
meta = k[1]
# else
# raise validators.ValidationError('.INI file not
formatted
# properly')
b=DataSetRegistration(data_set_type=type1,
data_set_name=set_name,
server_url=url,
start_date=start,
end_date=end,
metadata=meta)
b.save()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---