Is there an obvious way to do this in python?

H J van Rooyen mail at microcorp.co.za
Thu Aug 3 01:21:05 EDT 2006


"Simon Forman" <rogue_pedro at yahoo.com> wrote:



| H J van Rooyen wrote:
| > Hi,
| >
| > I want to write a small system that is transaction based.
| >
| > I want to split the GUI front end data entry away from the file handling and
| > record keeping.
| >
| > Now it seems almost trivially easy using the sockets module to communicate
| > between machines on the same LAN, so that I want to do the record keeping on
one
| > machine.
| >
| > I want to keep the "server" machine as simple as possible - just doing
record
| > keeping on a stimulus response basis - I would prefer it to do one thing at
a
| > time to completion because this style of operation, though limited in
| > performance, keeps a lot of hassles out of life - a transaction has either
| > completed, or it has not - recovery scenarios are relatively easy...
| >
| > Up to this point, I don't have a problem - my toy system can create a dummy
| > transaction, and I can echo it from the "server" machine, with more than one
| > "user" machine running - so I think it is feasible to have several tens of
"data
| > entry terminal" systems running, served by one not very strong machine.
| >
| > Now what I would really like to do is to differentiate between the 'User"
| > machines, so that some can do a full range of transactions, and others a
limited
| > range.
| >
| > And I would like to make this flexible, so that it becomes easy to introduce
new
| > transactions, without having to run around updating the code in all the user
| > machines, with the concomitant version number hassles.
| >
| > And I would like to do the whole thing in python - so my question is this -
is
| > it possible to do the equivalent of dynamic linking? - i.e. if I keep a list
of
| > what a user is allowed to do - can I somehow send him just the bits he needs
to
| > do the job, without having to change the static code on his machine? - it
seems
| > to me that the eval() thingy could possibly do this for me, by sending it
data
| > that makes it do import statements followed by calls to whatever... - will
this
| > work, or is there a better way?
| >
| > Or has all this been done already? - and no I don't want a web server and
php
| > and browsers and Java and html or xml... - I want to write something that
works
| > simply and reliably - its just short message accounting type data...
| >
| > - Hendrik
|
| Don't reinvent the wheel.  Use a database...

This believe it or not, is why I asked the question...

|
| You probably don't want to hear this, but what you just described is a
| GUI client front-end with a database backend.  The time it takes to
| download, install, and learn to use, say, postgres will be similar to
| the time you'd spend implementing what you've described above, but with
| at least 10 to 100 times the payoff.
|

In a way you are right - having just read postgres vs mySQL wars in another
thread on this group - but on the other hand I am lazy and dont really want to
spend time writing ISAM or hashed random access file methods either - I did my
share of that in the late sixties and early seventies - and I have not yet done
any "research" into the capabilities of the various contenders in this arena...
*ducks*

| As for updating the client on the fly, one strategy would be to keep
| the "dynamic" code in it's own module and have the clients reload()
| that module when you upload a new version of it to the client machines.
|
| Peace,
| ~Simon

This will work - but it is unsatisfying to me - I would have kind of liked to
have the client machine not even have all the code available - having the "bits
that can change" in one module implies some kind of build for every client if
they are to be to different - what I would rather write is the kind of thing
that is implemented in banking transaction terminals - the terminal has only the
code for the transactions that it is authorised to have, and these different
modules along with their parameters can be downloaded into it and activated on
the fly, one at a time...

And how to do that efficiently in python is really the question that I would
like to have answered, if possible...

Thanks for the response, Simon.

- Hendrik




More information about the Python-list mailing list