[Zope] Re: why DTML confusing

2000-11-14 Thread Irene Barg

To all of you that responded, I appreciate your comments.  I
will admit, after reading some of your comments, and going
back to the DTML Reference, this topic is discussed in the
section under "The special namespace variable".  Right before
my eyes, there is an example doing exactly what I wanted:

 20">

The dtml-in variables don't follow Zope's own rules on variable
names, but I've been told that this might change.  Beyond this,
when you need to do anything complex with DTML, the code gets
really ugly.  I have found it cleaner to just write an external
Python method to take care of such complex things like parsing
fields for wildcards, etc.. I will also look at Python Methods
and ZClasses.  

Finally, don't get me wrong.  I like Zope.  It's the best
solution I have found for through-the-web management and
program development.  I thank all of the Zope folks for that!

Cheers,
--irene
"Spicklemire, Jerry" wrote:
> 
> Irene says:
> 
> > I get so frustrated with DTML, I want to scream.
> > Please don't tell me to buy the Zope book,
> > DTML should be more intuitive.
> > DTML maybe the heart of Zope,
> > but it's also it's achilles heel.
> 
> You're right about the confusion, frustration, nor are you alone.
> Still, DTML isn't the heart of Zope, it's more like the fascia.
> DTML was intended to make the task of delivering dynamic content
> wrapped up in HTML-ish Templates easier. It evolved, and took on
> a broader scope that made it enticing for lot's of "other stuff".
> 
> Like most evolution, there are obvious benefits, and some
> unfavorable outcomes. The most glaring problems show up when
> you start trying to do things that seem to be just a step or
> two more sophisticated than simple examples that "just work".
> 
> There's good news. Python Methods, or whatever we end up calling
> them, make actually implementing such things as easy as Py(thon).
> For some folks, it may look like the bad news is, "Now I have to
> learn Python". In perspective, learning Python is way better than
> wading through the Zope API via DTML. Way way better.
> 
> So, the moral is, keep the DTML as simple as it can be. For
> anything else, reach for another tool. Zope has bunches of them.
> 
> BTW, the  stuff is the tip of the
> DTML Complexity Iceberg. The sooner you get comfortable with
> Python Methods, ZClasses, etc., the happier you'll be.
> 
> One last point. Python Methods (a.k.a. Restricted, Internal, or
> some other as yet unheard of alternative, which we are all
> anxiously awaiting) is an add-on at this point. Target date
> for inclusion as part of the standard "Core Zope" is Zope v.2.3.
> 
> For now, see: http://www.zope.org/Members/4am/PythonMethod
> 
> Later,
> Jerry S.
> 

-- 

Irene BargEmail:  [EMAIL PROTECTED]
Steward Observatory   Phone:  520-621-2602
933 N. Cherry Ave.
University of Arizona FAX:520-621-1891
Tucson, AZ  85721 http://nickel.as.arizona.edu/~barg


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] why DTML confusing

2000-11-10 Thread Irene Barg

Hello All,

I do read HOW-TO's, User-Guides, etc., but I think DTML
must be made simpler, or better documentation, or more examples.
As an example, within an  loop:

1.  You can print the values of sequence-items with:

(index=,
 number=,
 item=)

2.  To test for equality, this does not:


   ( Records found)


3.  While this does work:

   ( Records found)


I say this is confusing.  Don't tell me to read the Namespace
How-to, or the Zope User Guides, I did, and it's still confusing! 
Unless you find an example, that does exactly what you want, trying to
figure it out with the documentation available can be difficult.  I
found my answer to this in the 
"How-To: (How-to) access the field names and fields of any arbitrary
ZSQL query", but it took a lot of searching the 
Zope site for references to 'dtml-in'. I get so frustrated with DTML, I
want to scream.  Please don't tell me to buy the Zope book, DTML should
be more intuitive.  DTML maybe the heart
of Zope, but it's also it's achilles heel.

-- irene

------
Irene Barg  Email:  [EMAIL PROTECTED]
Steward Observatory Phone:  520-621-2602
933 N. Cherry Ave.
University of Arizona   FAX:520-621-1891
Tucson, AZ  85721   http://nickel.as.arizona.edu/~barg
--

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




Re: [Zope] XML-RPC vs External method?

2000-11-02 Thread Irene Barg

Kapil,

Thank you for this simple solution!  I'm new to XML and Zope
and sometimes I get caught in learning too many new things
at once, we forget to think "simply":-)  Thanks to you, I
don't need to use either External method, or XML-RPC.  The
following simple DTML method works:





 






  

  



Thanks again!
--irene
Ender wrote:
> 
> if the xml format is simple you could just do it dtml, it would end up
> with some extra white space but it would still be valid.
> 
> a dtml method akin to
> 
> 
> 
> 
>     
> 
> 
> 
> 
> kapil
> 
> Irene Barg wrote:
> >
> > Hello all,
> >
> > I have setup a query form to query a small MySQL database using
> > Zope.  It consists of:
> >
> > 1.  ZMySQL Database Connection (ZMySQLDA)
> > 2.  ZSQL method
> > 3.  A search interface.
> >
> > Now, what I want is the user to have the option of viewing the
> > results in HTML or raw XML.  I think there can be two approaches
> > to this:  1. External method, or 2. XML-RPC.
> >
> > 1.  External method:  Replaces the ZMySQL database connection
> > with an external Python function called 'mysqldb_XML', pieces
> > of which follow:
> >
> > def mysqldb_XML(self,query):
> > """
> > Use a MySQL SAX driver to map relational data to XML.
> > Hacked from PyXML saxdemo.py.  The MySQL driver is a modified
> > version of Sean McGrath's drv_mysql.py ("XML Processing with
> > Python").
> > """
> > from xml.sax import saxexts, saxlib, saxutils, writer
> > import sys,urllib
> >
> > #Our MySQLdb XML driver;
> > driver="xml.sax.drivers.drv_mysqldb"
> > .
> > out = sys.stdout;
> > p=saxexts.make_parser(driver)
> > dh=writer.PrettyPrinter(out,dtdinfo=info)
> > try:
> > p.setDocumentHandler(dh)
> > return p.parse(query)
> > except IOError,e:
> > return in_sysID+": "+str(e)
> > except saxlib.SAXException,e:
> > return str(e)
> >
> > Inside Zope, I get the ZSQL 'query' and do something like:
> >
> > 
> > 
> >   
> > 
> >
> > 2.  XML-RPC:  It seems to me XML-RPC could do this too, but
> > I don't know how one would print out the raw XML response.
> > Could I have a Zope client request the ZSQL method above,
> > but instead of sending it to my output DTML method, I just
> > print the raw-XML stream?  Examples would be helpful:-)
> >
> > It seems to me if XML-RPC already produces an XML formatted
> > stream, it would be more efficient to just use it (unless
> > there is yet another way in Zope I'm not aware of).  Is it
> > possible?  Is there any reason to want to use the external
> > method instead?
> >
> > Thanks for your comments,
> >
> > --irene
> >
> > --
> > Irene Barg  Email:  [EMAIL PROTECTED]
> > Steward Observatory Phone:  520-621-2602
> > 933 N. Cherry Ave.
> > University of Arizona   FAX:520-621-1891
> > Tucson, AZ  85721   http://nickel.as.arizona.edu/~barg
> > --
> >
> > ___
> > Zope maillist  -  [EMAIL PROTECTED]
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 

--
Irene Barg  Email:  [EMAIL PROTECTED]
Steward Observatory Phone:  520-621-2602
933 N. Cherry Ave.
University of Arizona   FAX:520-621-1891
Tucson, AZ  85721   http://nickel.as.arizona.edu/~barg
--

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] XML-RPC vs External method?

2000-11-01 Thread Irene Barg

Hello all,

I have setup a query form to query a small MySQL database using
Zope.  It consists of:

1.  ZMySQL Database Connection (ZMySQLDA)
2.  ZSQL method
3.  A search interface.

Now, what I want is the user to have the option of viewing the
results in HTML or raw XML.  I think there can be two approaches
to this:  1. External method, or 2. XML-RPC.

1.  External method:  Replaces the ZMySQL database connection 
with an external Python function called 'mysqldb_XML', pieces
of which follow:

def mysqldb_XML(self,query):
"""
Use a MySQL SAX driver to map relational data to XML.
Hacked from PyXML saxdemo.py.  The MySQL driver is a modified 
version of Sean McGrath's drv_mysql.py ("XML Processing with  
Python").
"""
from xml.sax import saxexts, saxlib, saxutils, writer
import sys,urllib

#Our MySQLdb XML driver;
driver="xml.sax.drivers.drv_mysqldb"
.
out = sys.stdout;
p=saxexts.make_parser(driver)
dh=writer.PrettyPrinter(out,dtdinfo=info)
try:
p.setDocumentHandler(dh)
return p.parse(query)
except IOError,e:
return in_sysID+": "+str(e)
except saxlib.SAXException,e:
return str(e)

Inside Zope, I get the ZSQL 'query' and do something like:



  



2.  XML-RPC:  It seems to me XML-RPC could do this too, but
I don't know how one would print out the raw XML response.
Could I have a Zope client request the ZSQL method above,
but instead of sending it to my output DTML method, I just
print the raw-XML stream?  Examples would be helpful:-)

It seems to me if XML-RPC already produces an XML formatted
stream, it would be more efficient to just use it (unless 
there is yet another way in Zope I'm not aware of).  Is it 
possible?  Is there any reason to want to use the external
method instead?

Thanks for your comments,

--irene 

--
Irene Barg  Email:  [EMAIL PROTECTED]
Steward Observatory Phone:  520-621-2602
933 N. Cherry Ave.
University of Arizona   FAX:520-621-1891
Tucson, AZ  85721   http://nickel.as.arizona.edu/~barg
--

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )