Re: [Zope] Creating Graphs

2000-08-18 Thread Patrick Lewis

On Fri, Aug 18, 2000 at 08:23:31AM -0700, Stuart Foster wrote:
> We need the ability to create multiple graphs from data that we get from
> Postgres.
> Currently we use a py method to call gnu plot, but we are looking for an
> alternative to serve up graphs.
> 
> Any suggestions? I took a look at the Python Image Library is this the best
> solution?
> 
> TIA
> 
> Stuart

Have you checked out the ZGDChart product?  I have no experience with it,
but it looks like another alternative.

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] retrieving data from REQUEST.form

2000-08-11 Thread Patrick Lewis

On Fri, Aug 11, 2000 at 01:08:48PM -0400, jesse wrote:
> I am creating a program, yet again.  How this works is, 
> 
> a zope factory calls a form, which submits data from a  to a DTML 
>document.  I want this DTML document to take the data from the form and display it on 
>multiple lines. For instance: 
> 
> If a person fills out the textarea like so:
> 
> First line
> second line
> third line
> 
> I want the DTML document to print out: 
> 
> First line
> second line
> third line
> 
> The only problem is, when the  submits to the document, (lets say the 
>textarea is called list), it submits it as a dictionary.  That means all the data is 
>on a SINGLE STRING.  So the data from the form looks like this. 
> 
>  = 
> {'list': 'first line/015/012second line/015/012third line'}
> 
> the /015/012 represent the line breaks.  
> 
> Seeing this, i used the replace function in zope, trying to replace the line breaks 
>with , which would be accepted by html.  however, whenever you try and access the 
>information in the form as a string...
> 
>  
> 
> it comes out with 
> 
> line one line two line three 
> 
> All the line breaks dissapear! So there is nothing to replace! Does anyone have any 
>ideas how I could solve this problem?  
> 
A couple of questions:

- You say that  returns 
  line one line two line three
  Is that in your browser window, or did you view the source html?

- Does ')" > work?

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] interating though REQUEST.form in python???

2000-08-08 Thread Patrick Lewis

On Tue, Aug 08, 2000 at 04:16:15PM -0300, Kevin Howe wrote:
> I'm trying to do a FOR statement to loop though items in a REQUEST, but keep
> getting errors:
> 
> def myMethod(self,REQUEST):
>   for name,value in REQUEST.form:
> # do this
> 
> I've tried variations:
> 
> for name,value in REQUEST.items:
> for item in REQUEST.form.items:
> for key in REQUEST.keys:
> 
> but none seem to work.
> 
> When I used "return REQUEST.form", a Dictionary was displayed like so:
> 
>   {'item': 'val1', 'item2':'val2', etc.}
> 
> so I tried fetching it as a plain dictionary:
> 
>   form = REQUEST.form
>   return form.keys

I think you want 

   for key in REQUEST.form.keys():

> 
> but no luck.
> 
> Is it not possible to access the REQUEST methods via python?
> 
> Kevin
> 
> 

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] compile ZPoPyDA product problems

2000-08-01 Thread Patrick Lewis

On Tue, Aug 01, 2000 at 10:54:50AM -0700, Stephen Nosal wrote:
> Folks -
> 
> I could use a hand here - I'm trying to compile the PoPy module for python so I can 
>use the ZPoPyDA to connect to my PostgreSQL database.
> 
> I keep getting the same compile error -
> 
> gcc - shared PoPymodule.o -lpq -o PoPymodule.so
> /usr/i486-suse-linux/bin/ld: cannot find -lpq

-Find libpq.so on your machine.
-Edit the last? (going from memory) line of Makefile, adding
   -L/directory/that/holds/your_libpq 
 (just the directory, not the filename) right before -lpq

There is certainly a more elegant way to do the same, but it worked for
me.

> 
> I have compiled other binaries on this machine, including Zope 2.2. Python runs 
>fine, I just don't know enough about ld to understand the error. (I get the same 
>error trying to compile ZPyGreSQLDA.
> 
> Any pointers would be greatly appreciated.
> 
> - Steve

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] FindOneOf?

2000-07-27 Thread Patrick Lewis

In a Python external method:

import re

def FindOneOf(to_find, search_str):
match_obj = re.search("[%s]" % to_find, search_str)
if match_obj:
return match_obj.start() + 1
else:
return 0

So, calling FindOneOf("ghd", "abcdefghij") returns 4.  This will work as
is unless searching for a '-' (which will work ok as long as it is at the
start of to_find).

Not quite sure what the third argument 1 is for in the ColdFusion
version, so say something if it is important.

On Thu, Jul 27, 2000 at 03:44:54PM -0400, Mabe, Brad wrote:
> ColdFusion (I know, a dirty word ;-) ) has a nifty string function called
> "FindOneOf" which returns the index of the occurrence of any character in a
> string.
> 
> Example:
>  FindOneOf("ghd", "abcdefghij", 1) 
> 
> Will return a "4" because "d" is the fourth letter in the string
> "abcdefghij".  If no match is made, a 0 is returned.  This is especially
> useful when building a change password form, because I can easily check to
> see that the new password contains at least one special character, upper
> case character, number, etc.  Is there anything similar to FindOneOf in
> ZOPE?  If not, does anyone have any hints on how I can go about doing this
> kind of thing through dtml or python?
> 
> -=Brad=-

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] while

2000-07-26 Thread Patrick Lewis

This is real ugly, but you asked (untested, but you get the idea):


  
  
  

  errormsg

  

  

  Oops! Exception never raised.


This only works if the loop will cycle less than 1000 times.  Needless to
say, this is done a lot easier in Python.

On Wed, Jul 26, 2000 at 05:46:18PM -0500, Leichtman, David J wrote:
> 
> But that's more like a for loop. No test condition.
> Basically, I want to keep redoing a method until a condition is met.
> 
> -Original Message-
> From: Daniel Rusch [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 26, 2000 3:19 PM
> To: Leichtman, David J
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: [Zope] while
> 
> 
> Try:
> 
> 
>  
> 
> 
> "Leichtman, David J" wrote:
> 
> > Is there an easy way to simulate the functionality of a while loop in
> DTML?
> >

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] simple dtml-if question

2000-07-26 Thread Patrick Lewis

On Wed, Jul 26, 2000 at 10:14:09AM -0700, joel grimes wrote:
> How do I do this?
> 
> I have a table with a field called SerialNumber.  I want to test it for null 
> and return a non-breaking space if it's null.
> 
> Here's what I tried:
> 
>  
> 
> 
> 

If null means an empty string (e.g. '') or the Python value None, the
first line should be:

nbsp;

or perhaps (empty string only)

nbsp;

It really helps to remember that anything inside double quotes gets
evaluated as a Python expression.  You were initially trying to assign the
value of null (which may have not actually existed) to SerialNumber.

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] request for advice

2000-07-21 Thread Patrick Lewis

On Fri, Jul 21, 2000 at 04:29:01PM +0100, Seb Bacon wrote:
> Hello folks,
> 
> I'm just beginning to design my first big Zope application.  I'm writing to
> ask zopististitiatatas for some advice, since I'm a bit of a newbie and I
> want to make sure:
> 
> [a] I reuse as much code as possible 
> [b] I make my code as reusable as possible
> [c] my application is stable and scalable
> 
> 1. Background to the application
> 
> I'm building an extranet product in Zope.  Much of it will be centered
> around a 'VersioningObject'.
> 
> An example of such an object might be an image, a Word document.  The
> objects will have a preview view associated with them.  For word docs, this
> will be a html-ised version, for photos it will be a thumbnail.  Perhaps in
> the future each object will also have rudimentary online editing facilities.
> 
> The objects will all support versioning.  This means each object can be
> superceded by another object of the same type.  The version number will be
> incremented.  Versions will also have Confera forums associated with them,
> and ACLs.
> 
> Now as I see it, I want a VersioningObject to be a Folderish object that can
> contain a set of Versions, which are just a load of File objects of the same
> type.  The folder has a method which slects its most recent child file
> object and displays it by calling its preview method.  Older versions are
> read-only and are listed by title only.
> 
> 2) My questions:
> 
> i) I'm worried about the sheer volume of binary data that would accrue in
> the VersioningObject: a single VersioningObject might be a Word doc of 25Mb.
> If it has 10 versions and there are 10 such objects, that's 2.5Gb in the
> ZOBD.  I presume this would be a bad idea performance-wise; any suggestions?
> ii) I'm interested in using ZPatterns because I reckon they sound like they
> might enhance the reusability etc. of the code; I know there have been some
> pointers recently, but which ZPatterns could I benefit from?  or are they
> too arcance to worry about for now?
> iii) Is there any other miscellaneous advice?  e.g. has anything like this
> been done already?
> 
> 
> Thanking you all, ladies and gentlemen.
> 
> Seb.

A couple of ideas: 

- Don't save your data (documents, images) in the ZODB. Instead, save it
to disk using the Local File System product.  This will prevent the ZODB
from getting too big for most OSes.

- I think it would be kind of interesting to use RCS for something like
this on the backend. Build your methods in Zope to manipulate RCS, and
then you get all the functionality of RCS "for free", and don't have to
reinvent the wheel. You may run into problems with people not working with
the most current document (I grab something from the database, Jill
commits some changes to the same document, I make some changes, commit
them, and destroy Jill's changes), but you would have that problem anyway
as you initially described it.

Hope this helps.

-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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] .dtml files

2000-07-12 Thread Patrick Lewis

The object has a method named manage_roleForm.  In your example, an object
which is (or inherets from) Role will have a manage_roleForm, and can be
accessed just like any other method, assuming adequate permissions.

Using an example I am more familiar with, if you have a DTML Document
index_html (which inherits from PropertyManager), you can call
index_html/manage_propertiesForm, which will render the file
'properties.dtml'.

This is one of those things that when I discovered it, I did the 'this is
so cool' dance.

-- 
Patrick Lewis
<[EMAIL PROTECTED]>

On Wed, Jul 12, 2000 at 01:30:13PM -0500, Daniel Rusch wrote:
> I've been digging into to the inner workings of Zope trying to gleen as
> much Zen as possible, before I implement a write of our existing
> framework.
> 
> During this process I have noticed that Zope's dtml pages are stored on
> the file system as .dtml files (i.e. roleEdit.dtml) The question then is
> how does Zope display this pages??
> 
> I have found function calls such as:
> manage_roleForm=HTMLFile('roleEdit', globals()) which I believe creates
> an HTML document template from the named file. But, what is the
> mechanism that calls/displays mange_roleForm?
> 
> Thanks in advance,
> 
> DR

___
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] Reversing acquisition?

2000-06-22 Thread Patrick Lewis

Try changing /index_html as follows:










Basically force Zope to look in the current folder first.

--
Patrick Lewis <[EMAIL PROTECTED]> 

On Thu, Jun 22, 2000 at 11:03:37PM +0800, [EMAIL PROTECTED] wrote:
> Hi All,
> 
> Here's the situation
> 
> I have a tree such that
> 
> /index_html
> /text_object_1
> /text_object_2
> /subfolder/text_object_1
> /subfolder/text_object_2
> 
> where content is:
> 
> /index_html
> 
>   
>   
>   
>   
>   
>   
> 
> /text_object_1
> 
>   Just some text of text_object_1
> 
> /text_object_2
> 
>   Just some text of text_object_1
> 
> /subfolder/text_object_1
> 
>   Just some text which is different from /text_object_1
> 
> /subfolder/text_object_2
> 
>   Just some text which is different from /text_object_2
> 
> The effect I would like to achieve is:
> when user access http://myserver/, 
> content of /text_object_1 and /text_object_2 will be shown
> while user access http://myserver/subfolder/, 
> content of /subfolder/text_object_1 and /subfolder/text_object_2
> 
> The point is that there's no index_html in /subfolder
> so /index_html will be acquested and by default it displays 
> content of /text_object_1 and /text_object_2
> 
> The question is: we got text_object_1 and text_object_2 in /subfolder
> how could I let the acquested index_html in subfolder to use the
> objects inside the subfolder?
> 
> If my desired effect could be achieved, that would be very useful
> as the whole site could use a master template at root, changing objects
> inside folder could show different content. While changing the root
> index_html will change the layout of the whole site
> 
> Otherwise we have to put the same "index_html" inside every folder
> so that default view of folders will show their containing object content.
> 
> If this is not easy, is there any other way to achieve the same effect?
> I don't want to use something like "http://myserver/?c=some_parameters"
> which is my current implementation (where site structured is not preserved
> or shown by URL)
> 
> Thanks,
> 
> Roger
> 
> ___
> 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 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] Zope jobs.

2000-06-21 Thread Patrick Lewis

Funny you should mention this. I have mocked up a job board at:

www.zope.org/Members/plewis/job_board

I am waiting on the folks at zope.org to decide if they want to give my
"add" method Owner proxy rights (hint, hint), and then I was going to more
widely announce it.  But, if you would like to privately email me with the
details, I would happily post it in the meantime.  The form should give
you guidance for what I need.

-- 
Patrick Lewis <[EMAIL PROTECTED]>

On Wed, Jun 21, 2000 at 12:37:47PM +0200, Erik Enge wrote:
> 
> Hi,
> 
> I was wondering.. Is there a place where I can post
> Zope job offerings?  Shouldn't there be such a place
> on zope.org?
> 
> (btw, anyone in England - or other parts of this planet - 
> interested in work, please e-mail me)
> 
> Thanks,
> 
>  Erik Enge
>  EMM Solutions
> 
> 
> 
> ___
> 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 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] Newbie CGI question

2000-06-21 Thread Patrick Lewis

Not sure this is what you are looking for, but here it goes:

On Wed, Jun 21, 2000 at 09:38:30AM -0700, [EMAIL PROTECTED] wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> How can I access the variables passed into a DTML called as a Form by
> another DTML? it has the usual ?x=1&y=2 ... stuff - I'd really like to loo
> through these.

I assume you have two fields in your form, like this:


  
  
  ...


Then, in foo_dtml, you would display them as:

 

Easy so far.

> 
> Also can I construct a string and then evaluate it? ie
> 
> varname="therealvar" + "name"
> 
>  varname
> 
> that would return the contents of the variable "therealvarname".

I think this is what you are looking for:


  
  


-- 
Patrick Lewis <[EMAIL PROTECTED]>

___
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 )