RE: [Zope] Picture of the day product

2001-01-17 Thread Eric Walstad

//  What I'm not sure about is how to have Zope automatically
//  display the photo
//  for a day, then archive it. Would a boolean property of the
//  ZClass work? Is
//  it possible to have Zope set the property of a ZClass instance
//  at certain
//  time? Any thoughts on how this would be designed?
Hi Tim,
Here's some code I use with a simple NewsItem ZClass that only displays
objects that have not yet "Expired".  With a little modification, it could
be used to test a "DisplayDate" value and if it matches the current date,
the photo would be displayed.  That way you could load a bunch of photos
into your site at once and give them specific display dates.  If more than
one had the same date, they would both be shown.

"Expires" is a property of my NewsItem ZClass that is of type "date".
"Expires+1" just adds a day to the expiration date so that my news items are
displayed up to, and including, their expiration date.  The NewsItem ZClass
has a meta type of "News Item," which is used in the "in" statement.  "view"
is a method of the ZClass that simply formats the NewsItem for displaying in
the browser.


  dtml-with News
  dtml-in expr="objectValues('News Item')" sort=id reverse
dtml-if "ZopeTime().lessThanEqualTo((Expires+1))"dtml-var
viewbr/dtml-if
  /dtml-in
  /dtml-with


Hope it helps...
Eric.


___
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] with a variable

2001-01-13 Thread Eric Walstad

//  I want to get some properties for a zclass instance after being
//  passed its
//  id in a variable. In these tests I have been defining the varible in the
//  code, in the final case it will be passed through the url.
//
//  Using the id directly as above works fine, it writes the
//  attribute to the
//  page.
//
//  Thanks for any help,
//
//  Josh On
Hi Josh,
I'm kinda new to this stuff, but I think I am doing something similar to
what you need.
I have a DTML method that grabs a ZCLass object's id from the query string
and uses it to
gain access to that ZCLass object.  It looks like I'm generating the id's
the same way
you are (not that that matters...)  I do it like this:
The URLs look something like this:
addUserToEvent?977952867
where 977952867 is the id of the ZClass object I want to work with

and the "addUserToEvent" method has this in it:
dtml-with "_.getitem(QUERY_STRING)"

...Do stuff with the ZClass reference here...

/dtml-with

I hope that helps.

Eric.


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

2001-01-11 Thread Eric Walstad

http://www.zope.org/Members/alanpog/zmysqlda_steps
Should get you started...
Eric.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of vishnu
prasad
Sent: Tuesday, January 09, 2001 3:17 PM
To: [EMAIL PROTECTED]
Subject: [Zope] MySQL


can anyone update me with list of activities that I need to follow for
having MySQL installed and integrated with Zope?

thanks in advance,
vp


___
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] PoPy Installation. Where's the BEEF?

2001-01-10 Thread Eric Walstad

Hello all,
After installing the ZPoPyDA product, restarting Zope and browsing to the
Products interface, I see:

ZPoPyDA Import Traceback
Traceback (innermost last):
  File "/usr/local/Zope/lib/python/OFS/Application.py", line 397, in
import_products
product=__import__(pname, global_dict, global_dict, silly)
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/__init__.py", line 32,
in ?
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/DA.py", line 35, in ?
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/PoPy_db.py", line 35, in
?
The PoPy module is not installed

So, it looks like I need to install PoPy.  I went to www.mixadlive.com (PoPy
PeOpLe :) and couldn't find
it there (I don't speak Italian, so it may be right under my nose).  I've
searched the
Zope archives and didn't see any leads there.

Can anyone give me a pointer?

Thanks,
Eric.


___
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] PoPy Installation. Where's the BEEF?

2001-01-10 Thread Eric Walstad

AAKK!  I just noticed something...
-8-- Start Snip --8-
ZPoPyDA Import Traceback
Traceback (innermost last):
  File "/usr/local/Zope/lib/python/OFS/Application.py", line 397, in
import_products
product=__import__(pname, global_dict, global_dict, silly)
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/__init__.py", line 32,
in ?
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/DA.py", line 35, in ?
  File "/usr/local/zope/lib/python/Products/ZPoPyDA/PoPy_db.py", line 35, in
?
The PoPy module is not installed
-8-- End Snip --8-
Notice the paths in the traceback.

I have one copy of Zope (no PostgreSQl support) in:
/usr/local/Zope

And another copy that will need to connect to PostgreSQL is in:
/usr/local/EcoZope

and ZPoPyDA is in:
/usr/local/EcoZope/lib/python/Products/ZPoPyDA/

The traceback is displaying wrong paths.  I searched the ZPoPyDA python
source for hard coded paths but didn't find any.  Is there an environment
variable that sets this?

Thanks for any help...
Eric.
____

Eric Walstad
[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] I SOLVED!!

2000-12-15 Thread Eric Walstad

Hi Paolo, you should post your solution to the mailing list so that if
others run into your same problem they can find your solution by searching
ht emailing list archives.
Just a thought.
Eric.

//  -Original Message-
//  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paolo
//  Quaglia
//  Sent: Friday, December 15, 2000 10:26 AM
//  To: [EMAIL PROTECTED]
//  Subject: [Zope] I SOLVED!!
//
//
//  THANKS TO ALL for your help But I solved the Probs with the PoPy DA.
//
//  Ciao
//
//  Paolo
//
//
//
//
//  ___
//  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] Problem on running the ZOPE by using ZmySQLDA

2000-12-13 Thread Eric Walstad

Hi Angie.

First off, I think there are some users in the list that are unable to read
HTML formatted email.  I've seen a lot of requests for folks to send only
plain text messages to the list.

Well, I don't run Zope on a Windows machine, so maybe I'm wrong here, but
the output you've shown below looks normal to me.  It doesn't look like an
error.  Is there any error message that's displayed in your browser?  If so,
can you recreate it and send it to the list?

Also, can you include the SQL statement that is causing the problem?  Have
you tried making a ZSQL Method that issues a really simple query, like:
SELECT * FROM InsertYourTableNameHere

You can also try this simple test from your "Z MySQL Database Connection"
object.  Just browse to that object in the Zope management interface, click
the "Test" tab and then enter the SQL statement.  Then click the "Submit
Query" button to test it.  It should return all the records in the table you
specified.  If it doesn't, I would hope it simply returns a traceback and
not crash Zope.

Hope that helps.

Eric.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Angietel
Sent: Wednesday, December 13, 2000 12:42 AM
To: [EMAIL PROTECTED]
Subject: [Zope] Problem on running the ZOPE by using ZmySQLDA


Finally my ZOPE is connected to MySQL succesfully, i can insert, delete the
record,but i can not search and view my record in ZOPE. When i go to MySQL
it can shows all my database records after my modification in ZOPE. Every
time when i want to search or view my records it will promt out the illegal
operation message in ZOPE and my pyhon will be exactly look like this:-

iles\WebSite\z2.py" -D
--
2000-12-13T08:34:28 PROBLEM(100) ZServer Computing default hostname
--
2000-12-13T08:34:31 INFO(0) ZServer Medusa (V1.16.4.2) started at Wed Dec 13
16:
34:31 2000
Hostname: ANGIE
Port:8080

--
2000-12-13T08:34:31 INFO(0) ZServer FTP server started at Wed Dec 13
16:34:31 20
00
Authorizer:None
Hostname: angie
Port: 8021
--
2000-12-13T08:34:31 INFO(0) ZServer PCGI Server started at Wed Dec 13
16:34:31 2
000
Inet socket port: 8090
--
2000-12-13T08:34:31 INFO(0) ZServer Monitor Server (V1.8) started on port
8099

C:\Program Files\WebSite

P/s let me know me that whether this is regard to my MySQL or ZOPE or
Python, but i have tried to reinstall all of them, and the situation is
still remain the same. Thanks for your concern.


___
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] Last day of Month

2000-12-12 Thread Eric Walstad

Hi Paolo,
I have a Python Metho... er  Python Script that I use that tells me the days
in each month.  You pass in a Zope DateTime object as a parameter and it
returns the days in that month:

Parameters: ZopeDateTime
Code:
-8-- Start Snip --8-
if ZopeDateTime.isLeapYear():
intDaysInFebruary = 29
else:
intDaysInFebruary = 28

strMonthName=ZopeDateTime.Month()

dicDaysPerMonth =
{'January':31,'February':intDaysInFebruary,'March':31,'April':30,'May':31,'J
une':30,'July':31,'August':31,'September':30,'October':31,'November':30,'Dec
ember':31}

return dicDaysPerMonth.get(strMonthName, 0)
-8-- End Snip --8-

Hope that helps.

Eric.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Paolo
Quaglia
Sent: Tuesday, December 12, 2000 4:05 AM
To: [EMAIL PROTECTED]
Subject: [Zope] Last day of Month


Hi everibody
Is there some tricky way to know the last day of the month of a DateTime
object?
for ex: if my DateTime object is 12/12/2000  is there a method or a
function that return the last day of the month? (in this example 31)

Thanks a lot
Paolo Quaglia
Information Technology Coordinator
Sitek S.p.A.
[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] Problem on connect to MySQL

2000-12-11 Thread Eric Walstad

Hello Angie,

Are you able to create a "Z MySQL Database Connection" inside Zope?
I'm not sure exactly when you are receiving your error message.  Is it when
you Click the "Change" button while in the "Z MySQL Database Connection?"

Your connection string looks like it is missing a user name.  It should look
something like (assuming your MySQL user name is "angie"):
customerDb@localhost angie pass52696
or in general terms
database@host user passwd

Generally when you see square brackets [ ] in documentation, the enclosed
code is optional.  In the case of the connection string, the host name is
optional.
However, in my setup, I have to include the host name or my connection to
the database will fail.

Hope that helps.

Eric.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Angietel
Sent: Monday, December 11, 2000 7:37 PM
To: [EMAIL PROTECTED]
Subject: [Zope] Problem on connect to MySQL


When i type in the Connection String , it will prompt out the error
message - "illegal operation" and in my python it will exactly like this:-

Files\WebSite\z2.py" -D
--
2000-12-12T03:15:10 PROBLEM(100) ZServer Computing default hostname
--
2000-12-12T03:15:11 INFO(0) ZServer Medusa (V1.16.4.2) started at Tue Dec 12
11:
15:11 2000
Hostname: ANGIE
Port:8080

--
2000-12-12T03:15:11 INFO(0) ZServer FTP server started at Tue Dec 12
11:15:11 20
00
Authorizer:None
Hostname: angie
Port: 8021
--
2000-12-12T03:15:11 INFO(0) ZServer PCGI Server started at Tue Dec 12
11:15:11 2
000
Inet socket port: 8090
--
2000-12-12T03:15:11 INFO(0) ZServer Monitor Server (V1.8) started on port
8099

C:\Program Files\WebSite  #// This is error msg

and i would like to confirm to u whether the Connection String is write like
this:-
customerDb[@localhost]Password pass52696


In mySQL i set up the user password like this:-
INSERT INTO user
VALUES('localhost','password',PASSWORD=Password('pass52696'),'Y','Y','Y',Y',
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
and my Database name is CustomerDb

P/s let me know where is my mistake! Thank You!


___
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] Rookie Question - Syntax

2000-11-29 Thread Eric Walstad

Hi Walter,
There's a good tutorial on how to design forms at:
http://www.zope.org/Members/jules/smarterforms_html

I like to let javascript handle the validation, it lightens the load a
little on the server.  I use Regular Expressions to check the validity of
each field.  There's a tutorial at:
http://www.netpedia.com/features/javascript/objects2/

There was also a recent flurry of postings on this subject.  You can search
for them at:
http://zope.nipltd.com/public/lists/zope-archive.nsf/$$Search?OpenForm

Hope that helps,

Eric.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Walter Pleyer
Sent: Wednesday, November 29, 2000 6:45 AM
To: [EMAIL PROTECTED]
Subject: [Zope] Rookie Question - Syntax


Hi folks!

I am a Zope/Python-Rookie and Ihave a probably quite simple
problem:

I must check if some must-fields from a form were filled out by a user.
Checking data from a single field is no problem, but what's the correct
syntax for checking more than one field (e.g. "name", "address", "email") ?

Thanx
Walter


___
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] Help!!

2000-11-28 Thread Eric Walstad

Hi Ot,
Try closing down all instances of your browser, then open up your browser
and login as your admin user.  You will be "logged out" when you close all
instances of your browser.
HTH,  Eric.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ot
Ratsaphong
Sent: Tuesday, November 28, 2000 7:16 PM
To: [EMAIL PROTECTED]
Subject: [Zope] Help!!


Hi,
I'm new to Zope and have just installed Zope on a Win98 PC.

I'm trying to install squishdot and TinyTable, but Zope tells me that
superuser has no permission to install the above products.

I have created another user called 'admin' with Manager priviledges but I
don't know how to logout of superuser and login as 'admin'.

I have tried shutting down Zope and closed off internet explorer and
restarting again but I still get into superuser.

If I need to login as a non superuser, how do I do this?

I have looked for all relevant documentation but can't find anything on
this.

Your help would be appreciated.

TIA
Ot Ratsaphong
Canberra, Australia


___
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] MySQL Connection String

2000-11-17 Thread Eric Walstad

I use the following format:

users@frankenstein privileged_user ThePassWord
- or in general terms -
TableName[@HostNameOfMachineMySQLIsRunningOn] MySQLUserName ThePassWord

I guess the "@HostNameOfMachineMySQLIsRunningOn" part is optional, but I
needed to put it in there for my setup.
The "privileged_user" is one that you've done a MySQL GRANT for. I.e.
something like:
GRANT SELECT,INSERT,UPDATE ON DatabaseName.TableName TO MySQLUserName
IDENTIFIED BY 'ThePassWord';

FYI, I found this info in ALANPOG's HowTo:
http://www.zope.org/Members/alanpog/zmysqlda_steps

hth, Eric.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Aitor
Grajal Crespo
Sent: Friday, November 17, 2000 8:37 AM
To: [EMAIL PROTECTED]
Subject: [Zope] MySQL Connection String


  I have installed ZMySQLDA 1.1.4,
anybody knows the format of the database connection string???

I have put database user passw , and doesn't work

Thanks


___
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] Generating text/csv from DTML method, Mime Type?

2000-11-10 Thread Eric Walstad

Here's some DTML I use to generate a CSV file on the fly using data returned
from a query of a MySQL database:

dtml-call "RESPONSE.setHeader('Content-Type',
'application/x-csv')"dtml-in qryAllDB
dtml-if sequence-start
FirstName,MiddleName,LastName,Address,City,State,Zip,Phone,Fax,Email,URL,Bir
thday
/dtml-if sequence-start
dtml-var FirstName null='',dtml-var MiddleName null='',dtml-var
LastName null='',dtml-var Address null='',dtml-var City
null='',dtml-var State null='',dtml-var Zip null='',dtml-var Phone
null='',dtml-var Fax null='',dtml-var email null='',dtml-var URL
null='',dtml-var Birthday null=''
/dtml-in

Notice that formatting is kinda ugly.  That's so that I don't get any
unwanted carriage returns nor any line feeds in the downloaded file.
Also, notice that the first line of the output (after the Content-Type, that
is) is a header line, which you may not want for your output.  I include it
so that when the file is viewed in a spreadsheet, the user can tell what
each column is.

FYI, I found a lot of info on this technique on NIP Ltd's mailing list
archive (Thanks again NIP!!):
http://zope.nipltd.com/public/lists.html


HTH,

Eric.

// -Original Message-
// From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
// Oliver Bleutgen
// Sent: Friday, November 10, 2000 8:12 AM
// To: [EMAIL PROTECTED]
// Subject: Re: [Zope] Generating text/csv from DTML method, Mime Type?
//
//
//  I'm create a CSV file that I would like browsers to get the "save as"
//  dialog when they select it.
//
//  I'm using RESPONSE.write() to write out the CSV file, and I set the
//  Content-Type before calling RESPONSE.write
//
//
//  Netscape seems to work ok, it pops up a save box for "text/csv" and
//  "application/vnd.ms-excel".
//
//  However in both cases IE5.5 just ignores the data and re-requests the
//  page.
//
//  Does anyone know *all* the steps I need to take to get this to work
//  correctly with IE? I must be doing something wrong. I want to supply a
//  CSV file, but generated dynamically. I'm sure I'm missing a header
//  setting or something.
// Adding "Content-Disposition: attachment [; filename=bla.csv]" as
// a http-header might help...
// The part in []s is optional .
// See my mail from yesterday for a bit more info
//
// cheers,
// oliver
//
// ___
// 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] Cookies Expiration

2000-11-07 Thread Eric Walstad

Oops, forgot to send this one to the list...

-Original Message-
From: Eric Walstad [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 03, 2000 3:40 PM
To: Steve Drees
Subject: RE: [Zope] Cookies  Expiration


Newbie_Alert
Hi Steve,
Your solution is very cool!  I'm going to use it in the following
form...
(maybe a bit more flexible?, change the default days to suit your needs)

ID: expireInNDays
Parameter List: self, days=1.0
_BODY__
t = self.ZopeTime() + days # user defined duration
t = t.toZone('GMT')

return t.strftime("%A, %d-%b-%Y %H:%M:%S GMT")
___
 On the page you want to set the cookie put:
 dtml-call "RESPONSE.setCookie('cookiename','cookievalue', path='/',
expires=expireInNDays(this(), 7.0))"
 or, to use the default of 1 day:
 dtml-call "RESPONSE.setCookie('cookiename','cookievalue', path='/',
expires=expireInNDays())"
Thanks  -Eric.
/Newbie_Alert



// -Original Message-
// From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Steve
// Drees
// Sent: Friday, November 03, 2000 2:02 PM
// To: Kit O'Connell; [EMAIL PROTECTED]
// Subject: RE: [Zope] Cookies  Expiration
//
//
//  However, I'd like to have this cookie set to expire one week
// from the date
//  of the current visit. i.e., if its 12:30 on 11/3 when a surfer
// visits my
//  site, I want Zope to set their lastVisited cookie to expire on 12:30 on
//  11/10.
//
// Have a pythonmethod
//
// ID expireIn1Week
// Parameter List self
// _BODY__
// t = self.ZopeTime() + 7.0 # 1 week in the future
// t = t.toZone('GMT')
//
// return t.strftime("%A, %d-%b-%Y %H:%M:%S GMT")
// ___
//
//
// On the page you want to set the cookie put
// dtml-call "RESPONSE.setCookie('cookiename','cookievalue', path='/',
// expires=expireIn1Week())"
//
//
//
//
// ___
// 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] Your thoughts about Zope-based database apps

2000-11-07 Thread Eric Walstad

Hi Alonso,

FYI, some of the list members have great difficulty in reading HTML
formatted messages.  It's best if you set your format to "Plain Text" before
submitting to the list.

I haven't yet implemented what you are considering, but I am interested in
doing so soon.  So, I am very interested in what you discover.  If you don't
mind, if/when you receive any emails that don't get CC'd to the Zope mailing
list, please forward them on to me, too.

I am an Access programmer and have a bit of experience with MySQL.  I've
given a lot of thought about how one would handle an Access-like interface
with Zope and MySQL over the web.  I'm anticipating a lot more development
time building the interface, but saving a bunch of time by not having to
keep multiple copies of the same DB up to date.  If you feel like
brainstorming on the "whats" and "hows" of such an application, I'ld love to
join in.

Thanks,
Eric.

2. In particular, what would be the best way to implement the inserting and
updating of records along with input data validation? (Retrieving data from
a database to show on a web page using Zope is straightforward as you know.)

I have a set of java script functions that I use for form field validation.
I like this approach because it puts the burden on the client.  However,
there are Zope products available that handle it on the server side.  Search
Zope.org for "Smarter Forms"


3. In several cases I'd like to implement a main form/subform, where the
subform allows the user to enter several items related to only one record in
the main form. Since every item might have many fields (say 20) I'd like to
present just the most important fields on a table, and allow the user to
view/enter/update all the fields for each item in a different web page.
Those of you familiar with Microsoft Access know that in Access it is
straightforward to implement this main form/subform interface. I wonder what
would be the best way of implementing this using Zope?

Using Zope to mimic a form / subform combination means that Zope will have
to generate a the input form and subform elements together before they get
sent to the user.  The user will then update the data sent by Zope.  When
the form is submitted, Zope will have to update the main form data, then
iterate thru the subform elements, modifying the subform data with each
iteration.  If records are to be added, it will require a client server
transaction for each record added (unless something is done with javascript,
where the form is generated dynamically.  Then, the user could add many
records and when the dynamically built form is submitted, Zope will have to
figure out how many records the user added).


4. Do you know of any existing Zope-based app similar to this?. Obviously,
the back-end doesn't have to be MySQL.

I haven't seen any yet, but I'm sure they're out there!


___
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] CGI product ( was ZServer serving CGI by itself )

2000-11-05 Thread Eric Walstad

Hi Fred,
Wow, you've left me in the dust.  I've not needed to try what you are
attempting and I don't know how Zope would handle passing the RESPONSE buck
to another application.  I hope someone with more "Zen" can answer the
particulars for you!
Best of luck.
Eric.

// However, I have a couple of added complexities.
//
// First, I have a lot of scripts, not just one.  I'd like to have the
// equivalent of a ScriptAlias in Apache, where I can tell Zope to treat
// everything in a certain directory as a CGI script.
//
// Second, my scripts do funky things like set cookies for authentication.
// So I need to tell Zope to basically get out of the way after calling the
// CGI script.  (Specifically, I don't want Zope sending the HTTP header.)
//
// Third, some of my scripts are long running processes and I'd like to be
// able to send results back to the client unbuffered.  With Apache 1.3.x,
// I'm able to run Python scripts with the -u flag to the Python
// interpreter to force unbuffered output (i.e. you see the progress
// instead of having to wait for the script to finish).
//
// I'm thinking of writing a CGIScript product to handle this.  My idea is
// that I could add a CGIScript object to any Zope folder, setting
// parameters as appropriate.  Parameters could include:
//
// 1) name of CGI script to execute on host machine or name of directory
// containing CGI scripts
// 2) buffer output
// 3) script sends HTTP headers
// 4) environment variables
// 5) exception handling
//
// Has a general CGI product in Zope already been done?  I've already
// written a few external methods in testing Zope, which is easy enough,
// but haven't yet tried to write a product.  How hard is it?  Anyone have
// any advice (aside from go with the flow and run Zope behind Apache)?
//
// Thanks,
// Fred
//
// P.S.  Is standard_error_message broken in Zope 2.2.2?  I couldn't figure
// out how to use error_value without the code in
// lib/python/ZPublisher/HTTPResponse.py throwing in extra html tags.  I
// finally just edited that file and things seem to be working.  Running
// with or without the -D flag didn't make any difference.


___
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] ZServer serving CGI by itself

2000-11-03 Thread Eric Walstad

Hi Fred,
// I haven't seen any documentation on how to add CGI capability to Zope.
//
// Before I spend my time writing a product or external method that allows
// me to call CGI programs from inside Zope, has anyone else already done
// this?
I have a C++ program I run from Zope and then return the results to Zope.
Just like you described, I farm the work out to an external method which
runs the CGI, grabs the results and hands them back to Zope.  Be sure to
hard code the line that calls your CGI.  Otherwise, the External Method
could be used to call any (potentially damaging) code on your Linux box.

The (simplified) DTML Method "displayResults":
dtml-var standard_html_header
dtml-let ws=CWebCGI  - This creates and initializes an object with the
External Method
pThe initial gas heating usage: dtml-var
"ws.calc.results.gashtg"/p
pThe simulation method is invoked: dtml-call "ws.simulate()"/p
- This invokes the Simulate method of the ws object, which is what calls
the CGI
pThe gas heating usage after the simulation: dtml-var
"ws.calc.results.interestingValue"/p - this displays the results of the
CGI call
/dtml-let
dtml-var standard_html_footer


The (simplified) External Method "CWebCGI":
import sys, os, string

class CResults:
"Container for results"
def __init__(self):
self.interestingValue = 0.0

class CCalc:
"Container for calculation data"
def __init__(self):
self.results = CResults()
self.parameters = "enter your CGI's parameter(s) here (if any)"#
Note this file is on the Linux Hard Drive, not the ZODB


class CWebCGI:
"Container for the simulation"
def __init__(self):
self.calc = CCalc()
self.execPath = "/path/to/the/CGIprogram"# Note this file is on
the Linux Hard Drive, not the ZODB.

def simulate(self):
f = os.popen(self.execPath + " " + self.calc.parameters)
lines = f.readlines()  # grab the output of the CGI here
status = f.close()
self.calc.results.interestingValue = string.split(lines[0], "=")[1]

def wsFactory():# - This is the "Function Name" of the 
External Method
return CWebCGI()


//
// Thanks for the bandwidth,
// Fred
Hope it helps,

Eric.


___
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] ZServer serving CGI by itself

2000-11-03 Thread Eric Walstad

Oops, replace "gashtg" with "interestingValue" below.  Sorry I missed
t.  -E
... "ws.calc.results.gashtg"/p
should be
... "ws.calc.results.interestingValue"/p


___
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] Installation on Linux

2000-11-01 Thread Eric Walstad

Hi Lee,
In the Zope book beta version there is a section on installing Zope on
Unix/Linux systems:
http://www.zope.org/Members/michel/ZB/UsingZope.html
- Or -
There are also a few good howtos on the Zope.org site, here's one to get you
started:
http://www.zope.org/Members/mcdonc/HowTos/zopeinstall/ZOPE-INSTALL-HOWTO

Also, check out a list of Installation/Setup Gotcha's for beginners which
you should peruse the second you get stuck:
http://www.zope.org/Members/jens/docs/newbie_caveats

Then, when you have specific questions, search for answers on the mailing
list archive that NIP Limited has been kind enough to maintain.  This has
been a fantastic resource for me:
http://zope.nipltd.com/public/lists/zope-archive.nsf/

HTH,

Eric.

// -Original Message-
// From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Lee
// Curtis
// Sent: Wednesday, November 01, 2000 2:17 PM
// To: [EMAIL PROTECTED]
// Subject: [Zope] Installation on Linux
//
//
// Hi All,
//
// I feel like a bit of an idiot, but I can't find any info about installing
// Zope until Unix - only Windows.
//
// Can anyone give me a quick start guide ??
//
//
//
//
// Much Appreciated
//
//
//
// Lee Curtis
//
//
// ___
// 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 )




[Zope] OT Zope book images - PDF

2000-11-01 Thread Eric Walstad

In light of all the hubbub about the Zope book, I thought I would try and
make my own copy of it in PDF format (just for me, of course).  I'm finding
that Acrobat doesn't know how to convert the PNG image file type used in the
Zope Book.  (or rather, I don't know how to get it to work !)  Anyone know
how to get png files into Acrobat?  Oh, I'm trying to use their 'Open Web
Page' method of creating the document.  Is there another/better way that
will get the png images?
Thanks,
Eric.


___
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-if problem

2000-10-19 Thread Eric Walstad

Hi Terry - Disclaimer: I'm a Zope Newbie...
Here's what I'd try:

Length of the value of Area is: dtml-var
expr="_.len(Area)"br
Length of the 'strip'ped value of Area is: dtml-var
expr="_.len(_.string.strip(Area))"br

If you see somethinkg like:
Length of the value of Area is: 4 (or more)
Length of the 'strip'ped value of Area is: 3
when you view the DTML method, you have either white
space in your Area variable or a linefeed charater,
or...

If that's the case, here's a working if statement:
dtml-if "_.string.strip(Area)=='BIS'"

You could also try:
dtml-if "_.string.find(Area, 'BIS')0"
which will search for an instance of 'BIS' in the
value of the Area variable

Hope it helps,

Eric.

// -Original Message-
// From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Terry
// Babbey
// Sent: Thursday, October 19, 2000 1:37 PM
// To: [EMAIL PROTECTED]
// Subject: [Zope] dtml-if problem
// 
// 
// The following will not evaluate true and I am
stumped again.
// 
// dtml-if "Area == 'BIS'"
// 
// Area is a variable I am passing to my method and I
want to check to
// see if the variable is set to BIS, but it never
returns true even
// though a dtml-var Area displays BIS.
// 
// Confused as always,
// Terry
// 
// --
//
__
// Terry Babbey
// Technical Support Specialist
// Lambton College, Sarnia, Ontario, Canada
//
__
// 
// 
// 
// ___
// 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 )
// 

__
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

___
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] (no subject)

2000-10-17 Thread Eric Walstad

Hi Rob,
I'm a newbie, but I just finished doing what you are trying to do.  Here's
how I did it:
Product name: NewsItem
ZClass: CNewsItem
Property Sheet: NewsProperties

In the BuildNews dtml method:
dtml-call "REQUEST.set('ts', ZopeTime())"
dtml-call "REQUEST.set('id', _.str(_.int(ts)))"

dtml-with "manage_addProduct['NewsItem']"
  dtml-call "CNewsItem_add(_.None, _, NoRedir=1)"
/dtml-with

  dtml-with "_.getitem(REQUEST['id']).propertysheets.NewsProperties"
dtml-call "manage_changeProperties({
  'PostedBy' : REQUEST['PostedBy'],
  'email' : REQUEST['email'],
  'Title' : REQUEST['Title'],
  'Content' : REQUEST['Content'],
  'Expires' : REQUEST['Expires'],
  'IconPath'  : REQUEST['IconPath'],
  'DetailURL'  : REQUEST['DetailURL'],
  'DetailDescription'  : REQUEST['DetailDescription']})"
  /dtml-with

dtml-call "RESPONSE.redirect(URL2)"

Hope it helps.

Eric.

// I want to create a large number of properties for a Zclass.
// My Zclass has a propertysheet named Schedule.
//
// I've tried stuff like this:
//
// dtml-with propertysheets
// dtml-with common
// dtml-with Schedule
// manage_addProperty(name='foo', value='bar', type='string')
// /dtml-with
// /dtml-with
// /dtml-with
//
//
// The dtml-with's don't get an error, so I must be popping namespaces on
// properly.  But the manage_addProperty always results in:
//
// invalid attribute name, "manage_addproperty(name", for tag dtml-call
// manage_addProperty(name='foo', value='bar', type='string'), on
// line 10 of makeSched
//
//
// =Rob==
// J=
// =Roos=


___
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] HELP! Permissions problem, ZClass

2000-10-16 Thread Eric Walstad

Help, pls! I have a ZClass that is functioning beautifully if I am logged
in, but the anonymous user keeps getting prompted for a password.  The
problem occurs when my DTML method trys to  create a new instance of the
ZClass.  I tried giving that DTML method a Proxy of "Manager" but that isn't
helping.

Any pointers?

Thanks,

Eric.

Here's the traceback:
Zope Error

 Zope has encountered an error while publishing this resource.

 Unauthorized

 You are not authorized to access CNewsItem.

 Traceback (innermost last):
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line
222, in publish_module
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line
187, in publish
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line
171, in publish
   File /usr/local/Zope/lib/python/ZPublisher/mapply.py, line
160, in mapply
 (Object: buildNews)
   File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line
112, in call_object
 (Object: buildNews)
   File /usr/local/Zope/lib/python/OFS/DTMLMethod.py, line 172,
in __call__
 (Object: buildNews)
   File
/usr/local/Zope/lib/python/DocumentTemplate/DT_String.py, line 528, in
__call__
 (Object: buildNews)
   File /usr/local/Zope/lib/python/DocumentTemplate/DT_With.py,
line 146, in render
 (Object: manage_addProduct['NewsItem'])
   File /usr/local/Zope/lib/python/DocumentTemplate/DT_Util.py,
line 337, in eval
 (Object: CNewsItem_add(_.None, _, NoRedir=1))
 (Info: _)
   File string, line 0, in ?
   File /usr/local/Zope/lib/python/OFS/DTMLMethod.py, line 168,
in __call__
 (Object: CNewsItem_add)
   File
/usr/local/Zope/lib/python/DocumentTemplate/DT_String.py, line 528, in
__call__
 (Object: CNewsItem_add)
   File /usr/local/Zope/lib/python/DocumentTemplate/DT_With.py,
line 133, in render
 (Object: CNewsItem.createInObjectManager(REQUEST['id'],
REQUEST))
   File /usr/local/Zope/lib/python/DocumentTemplate/DT_Util.py,
line 331, in eval
 (Object: CNewsItem.createInObjectManager(REQUEST['id'],
REQUEST))
 (Info: CNewsItem)
   File /usr/local/Zope/lib/python/OFS/DTMLMethod.py, line 194,
in validate
 (Object: buildNews)
   File
/usr/local/Zope/lib/python/AccessControl/SecurityManager.py, line 139, in
validate
   File
/usr/local/Zope/lib/python/AccessControl/ZopeSecurityPolicy.py, line 209, in
validate
 Unauthorized: (see above)


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