Best way to find starting directory
davea at davea.name
Wed Mar 20 09:56:16 CET 2013
On 03/20/2013 01:58 AM, Frank Millman wrote:
> On 19/03/2013 17:03, Dave Angel wrote:
>> On 03/19/2013 10:29 AM, Frank Millman wrote:
>>> On 19/03/2013 14:46, Dave Angel wrote:
>> In putting them there, you are making two assumptions. One is that only
>> one user will ever run this, and two is that the user will not need two
>> sets of those 'schemas'. If the user is tracking two different
>> companies, each with the same code, but different xml and different
>> database, this would be the wrong place to put it. But it's up to you
>> to decide those assumptions, not I.
> Maybe I did not explain very well. I fully expect a large number of
> users, tracking a large number of companies, to access the same schema
> file at the same time.
So the scheme does NOT describe an individual company, but something
more general? Presumably there's a separate database per company? Why
then is the schema separately stored in each database?
> In fact I use lxml to parse the xml once it has been read from the
> database and decompressed. There are a limited number of 'types' of xml
> file (form definition, service definition, report definition, etc), and
> each type has its own schema. lxml will use a validating schema if you
> pass the path to the xsd file as a parameter to the parser. I create
> separate parsers, one for each type, when the program starts. But I
> still need to tell it where to find the xsd file.
> They are stored in a sub-directory called 'schemas'.
Clearly I don't understand your model well enough to advise you one way
or the other. All I can do is ask questions whose answers might remind
you of things you know but I do not.
This code is running on a server, with simultaneous users? And all
users who run it will be using identical xml, which will only be updated
when a new version of the script is installed? And each time a user
starts the application, you read the xml from the database, write it to
a sub-directory 'schemas' and subsequently in the run you access it
with lxml? You've considered what happens when one user is creating the
files, while another user is still accessing them?
Are these 'files' so enormous that you can't just use in-memory file
The analogy to global variables must be clear. They're fine if they're
constant. But as soon as you have multiple threads making new versions
of them, everything can easily get out of whack.
More information about the Python-list