Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41576
| Date | 2013-03-20 04:56 -0400 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: Best way to find starting directory |
| References | (2 earlier) <ki975r$odu$1@ger.gmane.org> <51485E35.7090501@davea.name> <ki9snt$hrk$1@ger.gmane.org> <51487E55.6040704@davea.name> <kibj5h$nks$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3552.1363769790.2939.python-list@python.org> (permalink) |
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: >>> <SNIP> >> 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 objects? 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. -- DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Best way to find starting directory Dave Angel <davea@davea.name> - 2013-03-20 04:56 -0400
csiph-web