[DB-SIG] Re: [Python-Dev] database APIs
Luke Kenneth Casson Leighton
lkcl@samba-tng.org
Tue, 4 Feb 2003 10:20:34 +0000
On Mon, Feb 03, 2003 at 11:35:05PM +0100, Magnus Lycka wrote:
> At 16:31 2003-02-03 -0500, Kevin Jacobs wrote:
> >On Mon, 3 Feb 2003, Luke Kenneth Casson Leighton wrote:
> >> my goal ultimately is to be able to write a file, maybe in
> >> XML or other suitable text file format, that specifies all the
> >> reports i want, that they are just tabular display of records,
> >> generation of an input form, or generation of create / delete
> >> input form.
>
> What makes you think XML will be a better very high level programming
> language than Python?
see http://sf.net/projects/virgule and then tell me if you
think that question _really_ needs asking of me!!!!!!
> Isn't that really what you are saying?
nope.
> And don't
> you think that special cases will pop up now and then that will be much
> easier to handle in Python than in XML?
i believe i described, later in the email to which you replied,
that it should be possible to over-ride special cases.
SQLObject does this by checking for the existence of some
functions in the over-riding class, where the name of the
function to check for is _{column_name}_{update|del|set}()
or something like that.
for example in the display of certain fields in a table,
in pysqldb i provide a means to pass in a function to
perform the HTML rendering.
if no such function is given on a per-column basis, then
cgi.escape(str(value), 1) is used.
the idea that i had was that the XML file should specify the
module and the function name to be used to display the
column.
alternatively, the XML file specifies the class name (or a
particular class name is expected by default based on other
context e.g. the table name, report name etc) and if that
class exists, and a function _in_ that class exists with the
name display_in_html_format_{column_name}() then it is called
to render the relevant field.
the same technique may be used to specify the reporting format:
the XML file specifies the type of the report by name, and
a rendering module is expected to contain a function by that
same report name, which does the actual work.
ultimately i really don't care what is used.
XML, HTML/templating, SQL databases, flat files or python.
i just want simpler applications.
> I'm sure you are right about constructing something along what you
> are talking about, or using one of these available tools, but I still
> think Python scripts, using these more abstract tools, is the optimal
> tool do describe each form or report in.
>
> What is it you can do in XML that you can't to in a structure of
> nested lists etc in Python?
you can't get python accepted by perl or php programmers or
non-technical administrators.
you _can_ get the pyxml libraries to read XML documents into
structures of nested lists etc.
you _can_ get XML accepted by other editing systems.
win-win.
[you can also get flat-file and SQL databases accepted by
non-programmers]
l.
[@BEGIN IRRELEVANT XML STUFF
hit delete, now, if you don't want to hear about XML...
> There are certainly a lot of things you
> can do in Python that you can't easilly do in XML...
tell me about it.
xvl/virgule is a non-NP-complete programming language with an
XML-based-syntax.
your comments here lead me to believe that you misunderstand
what XML is, can, and cannot do.
XML is nothing without meaning being provided.
it's just a pretty data format.
XML doesn't run, it doesn't execute, it doesn't sing or dance.
for XML to have meaning, there must be three things:
- the data.
- the interpretation of the data.
- a program to make use the interpreted data.
if you do not have any one of those three things,
XML is xxxxing useless.
i recommended XML on the basis that it is becoming widely
accepted as a data format.
people often mistake it as magic :)
@END IRRELEVANT XML STUFF]