Re: [Zope] Non-blocking MailHost

2000-09-04 Thread Richard Taylor




I think what people have in mind (correct me if I am wrong) is
something that will accept messages (for posting to the mailhost at
some time in the future) and then immediately return. I guess it would spawn
another process/thread to do the posting asynchronously.

The problem, as I see it is how to handle an error with the
posting. The user who submitted the mail is now long gone so it must
be left to an administrator to pick up the pieces.

Perhaps the posting routine could accept a user (developer) provided
exception handler that gets called if a posting fails.

It maybe better to just hand this off to a completely separate program
rather than try to handle it within a zope thread.

Richard 

[EMAIL PROTECTED] writes:

> Chris,
> 
> Out of curiosity, what exactly is a non-blocking MailHost?
> 
> On Mon, Sep 04, 2000 at 09:31:15AM +0100, Chris Withers wrote:
> > 
> > What we really want is a non-blocking MailHost.
> > 
> > Anyone know how or want to write one?

___
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] Re: Zope.org feedback

2000-07-07 Thread Richard Taylor

cvi <[EMAIL PROTECTED]> writes:

>   Hi,
> Thanks for your help, but I've got some problems with etcUserFolder
> because I don't know where I should put my password file. I'd also like
> to know how to use the variable that contains the role of the user, in
> a Python script. I know that to get the username, you must use the
> variable REQUEST.AUTHENTICATED_USER. Could you help me ?
> 
> THANKS A LOT FOR YOUR HELP.

You have two options:

1) To get a list of roles -


2) To check if they have a specific role -


Hope this helps.

Richard



PS. cvi I am sending this to the list because your email address does
not work!

___
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 with database packing (major data loss)

2000-07-07 Thread Richard Taylor

Brian Lloyd <[EMAIL PROTECTED]> writes:

> > On Zope 2.1.6 if you you pack the database with '0' in the days box
> > and then pack it again with '1' in the days box bad things happen. In
> > our case the first pack resulted in a Data.fs of 17MBytes (not bad
> > from a started point of nearly 2GBytes) the second pack (which I
> > assumed would do nothing) resulted in a Data.fs of 3MBytes. Great I
> > thought, however it also broke most of my site. Some of the symptoms
> > are:
> > 
> > Accessing existing folders gives KeyError
> > Many of my ZClasses are turned into DTML Methods (that is the icon
> > next to them in the folder view is a DTML Method icon)
> > All the instances of the broken classes are broken.
> > 
> >  
> > Thankfully I kept backups before performing the packs.
> 
> Richard - 
> 
> A notice was sent out to the list a week or so ago on this - 
> there is a bug in the packing machinery that (as you found) 
> doesn't correctly handle things when you pack to certain time 
> and then subsequently pack to an earlier time. The fix for 
> this is already checked in for 2.2.
> 
> Brian Lloyd[EMAIL PROTECTED]
> Software Engineer  540.371.6909  
> Digital Creations  http://www.digicool.com 
> 
>

Brian

You have my apology I did not spot the this notice.

I shall move to 2.2 just as soon as it is out of Beta testing.

Richard

___
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] Problem with database packing (major data loss)

2000-07-07 Thread Richard Taylor



We have discovered a rather nasty problem. 

On Zope 2.1.6 if you you pack the database with '0' in the days box
and then pack it again with '1' in the days box bad things happen. In
our case the first pack resulted in a Data.fs of 17MBytes (not bad
from a started point of nearly 2GBytes) the second pack (which I
assumed would do nothing) resulted in a Data.fs of 3MBytes. Great I
thought, however it also broke most of my site. Some of the symptoms
are:

Accessing existing folders gives KeyError
Many of my ZClasses are turned into DTML Methods (that is the icon
next to them in the folder view is a DTML Method icon)
All the instances of the broken classes are broken.

 
Thankfully I kept backups before performing the packs.

This is repeatable on both the servers I run.

I am now nervous of packing but have no choice. 



Richard

PS. I still think Zope is great! I am just learning slowing how to run
it defensively


___
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] Newbe question concerning using python classes and external methods

2000-07-06 Thread Richard Taylor

"Gaspard, Bradley S" <[EMAIL PROTECTED]> writes:

> All,
> 
> I am a new Zope user and I guess I'm missing something fundemental that I
> haven't been able to glean from the documentation and various "How-to's".
> As a learning tool I am trying to implement one of Brian Lloyd's examples I
> found on the Web implementing a GuestBook.  
> 
> I suspect what I don't understand is how to write the external method that
> would make use of this class (The one I have been playing with follows the
> class definitions).  Anyhow, I've created an an external method and call
> (e.g. ) after which the guestBookForm is displayed.  After
> filling out the form and submitting it Zope does not seem able to find the
> signGuestBook method.  What am I doing wrong??
>

I not to sure why you have gone down the route of doing all of this as
an external method? I would have thought that the form should be
generated from an DTMLDocument and a signal function in the External
method could do the file-stuff and return the success page, no real
need for the class at all. But, I guess you are just using this as a
learning exercise, so what do I know.


Zope can't find you signGuestBook function because it knows nothing
about your  GuestBook class. The only thing you have told it about is
the ExternalMethod AddGuest. You could add another ExternalMethod
something like (code not tested):

 def SignGuestBook(name,email):
   myGuestBook=guestbook.GuestBook('My GuestBook', 'guestbookdata.txt')
   return myGuestBook.signGuestBook(name,email)

then create a DTMLmethod call signGuestBook:



you will need to add the SignGuestBook function as an external method
in addition to the one you already have.

You can see from this that the creation of an instance of the
GuestBook class is pretty pointless because it only exists within the
scope of the function in which it is created.

Another thing to bear in mind (it caught me out recently) is that
ExternalMethods are load once when Zope is started (or they are first
called, I am not sure which) not every time they are called. This
means that any global variables you create are common to every
call. As Zope is multithreaded this may catch you out if you do not
consider it.

Hope this helps.

Richard

> Other than mostly trivial examples, I haven't been able to find many
> complete (working) examples of using external methods.
> 
> Thanks in advance for any help.
> 
> """Module guestbook: a simple guestbook application"""
> 
> class GuestBook:
>   """A guestbook object that provides both the forms
>  and the handling of submitted form data."""
> 
>   def __init__(self, title, filename):
> self.title=title
> self.filename=filename
> 
>   def guestbookForm(self):
> """Return the guestbook from to the user"""
> return """
> %s
> 
> %s
> Please sign our guestbook!
> 
> 
> Name: 
> Email: 
> 
> 
> 
> """ % (self.title, self.title)
> 
>   def successPage(self):
> """Return a page to thank the user on success"""
> return """
> %s
> 
> Thank You!
> Thank you for signing %s!
> 
> """ % (self.title, self.title)
> 
>   def signGuestBook(self, name, email='not specified'):
> """Handle a submitted guestbook form"""
> 
> # Open a file to save the guestbook entry
> try: 
>   file=open(self.filename, 'a')
> except IOError:
>   file=open(self.filename, 'w')
> entry='Guestbook entry: %s %s\n' % (name, email)
> file.write(entry)
> file.close()
> return self.successPage()
> 
> External method
> 
> import sys
> sys.path.append('/usr/local/src/Zope-2.1.6-linux2-x86/lib/python/Shard/jscap
> e/winsat')
> 
> import guestbook
> 
> def AddGuest(self):
>   myGuestBook=guestbook.GuestBook('My GuestBook', 'guestbookdata.txt')
>   return myGuestBook.guestbookForm()
> 
> Brad
> 
> ___
> 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] CorruptTransactionError (Bad news for production site!)

2000-07-06 Thread Richard Taylor


Jim

Thank you for your prompt response. This is what I love about using
Open Source Software, the responses come from peole who really know
what they are talking about.

Further responses in-line.



Jim Fulton <[EMAIL PROTECTED]> writes:

> Richard Taylor wrote:
> > 
> > Today I had to role back two days of transactions from my production
> > site because when I packed the database I was informed of a
> > CorruptTransactionError.
> 
> Did anything else happen previous to this? Did you run out of space
> or anything like that?
>

We had been doing some extensive development work and the ZDB had
reached about 2Gbytes, but the disk was not full. I packed the
database (down to 10M approx.) without any trouble. We then carried
on using the system for another two days and I then packed the
database again. This time I got the CorruptTransactionError. I
followed the instruction to truncate the database and successfully
recovered it. Close examination of the bobo_modification_times on the
objects left in the database showed that the error occurred at about
the time of the first pack.
 
> You should have been able to use Data.fs.old, which is a copy
> of the database before the pack to restore the data. Or was the
> error in there too?  I'd be interested in looking at the Data.fs
> file before the pack to try to figure out what might have gone wrong.
> 
Unfortunately the error occurred after (or during the first pack) the
second pack over-rote the Data.fs.old with the corrupt database. The
real problem was that the corrupt transaction did not have an
immediate affect.

> (If you send my your Data.fs file, please remember to send it
> to me privately and to zip or compress it. :)
>
I would love to send you the Data.fs file but unfortunately it
contents sensitive commercial information for my company and I would
be sacked for sending it out. 

I know how difficult it is to track down bugs when people will not
give you repeatable examples, but I just can't send this stuff out.

> > We are using Zope for an internal knowledge management application
> > where anyone in the organization can add objects. So I have no way of
> > know what was added after the fateful transaction and no way of
> > getting any of it back.
> > 
> > Bummer!
> 
> Indeed.
> 
> > I think this raises a few questions about ZDB:
> > 
> > 1) We need some tools for selectively removing bad transactions
> >rather than just truncating Data.fs back to the last good one and
> >loosing everything that comes after it.
> 
> Zope 2.2 has just such a tool. In the ZODB directory, there is a 
> Python script, fsrecover.py which simply calls the recover function
> in the FileStorage module. This will work with any 2.x databases.
> It scans from both the beginning and the end of the file until 
> it finds a corrupted section and then removes the corrupted portion
> from the file.  You utility modifies the file in-place, so you need
> to shut-down the site, or work on a copy when you use it.
>

Fantastic! this is exactly what I was banging on about. No if only I
had not deleted the original corrupt Data.fs file out of discussed I
would be able to get back my stuff (I think I need a serious talking
to.)
 
> > 2) We could do with a tools that can verify the ZODB offline. This
> >could then be run at regular intervals (maybe once an hour from
> >cron) so that corruptions can be picked up earlier.
> 
> You could use a little Python script that did something like:
> 
>   import ZODB.FileStorage
>   file_name='../../var/Data.fs'
>   file=open(file_name, 'r+b')
>   index={}
>   vindex={}
>   tindex=[]
>   ZODB.FileStorage.read_index(
> file, file_name, index, vindex, tindex)
> 
> This basically reads the FileStorage index as would normally
> be done during startup.
>

I shall be installing (and testing) this tonight!

> > 3) Some way to find out what was added after a corrupt transaction is
> >needed so that at least I could see who I need to ask to re-add
> >their stuff.
> 
> The fsrecover script should avoid the need for this.
>

Agreed.
 
> Jim
> 

Richard

___
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] CorruptTransactionError (Bad news for production site!)

2000-07-05 Thread Richard Taylor



Today I had to role back two days of transactions from my production
site because when I packed the database I was informed of a
CorruptTransactionError. 

We are using Zope for an internal knowledge management application
where anyone in the organization can add objects. So I have no way of
know what was added after the fateful transaction and no way of
getting any of it back.

Bummer!

I think this raises a few questions about ZDB:

1) We need some tools for selectively removing bad transactions
   rather than just truncating Data.fs back to the last good one and
   loosing everything that comes after it.

2) We could do with a tools that can verify the ZODB offline. This
   could then be run at regular intervals (maybe once an hour from
   cron) so that corruptions can be picked up earlier.

3) Some way to find out what was added after a corrupt transaction is
   needed so that at least I could see who I need to ask to re-add
   their stuff.

I love Zope I think it the best web application framework I have use
(and I have used many), but this incident has shaken my confidence in
the ZODB. I can live with the occasional error and I don't object to
having to do some work to recover things. But, this appears to be an
error from which I can not recover my data even though I have backups.

Richard



PS. Is there anyone offering commercial support for Zope in the
UK. The more I am relying on Zope the more I think I need someone to
provide guaranteed backup.

___
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] Problems with Postgres 7.0

2000-06-02 Thread Richard Taylor



I am having problems with the new release of Postgres (7.0). 

I have an application that has been connecting to a Postgres 6.5
database through ZPyGres without any problems. When I upgraded to 7.0
the query hangs the database connection and zope. Zope will not
respond to any requests until I manually kill the 'postgres' process
that is doing the query.

I can issue the query direct to postgres through the command line
without a problem.

I thought this might be something to do with ZPyGres not being thread
safe but I get the same results even if I force zope to only run 1
thread.

Has anyone else seen problems with ZPyGres and Postgres 7.0?

For now I have had to revert to Postgres 6.5.

I did see some discussion on this list recently about something called
ZPoPyDA but I can find no reference to it on the Zope web site. If
this is a development of a new Postgres DA I would be very interested
to see if it solves my problem, can anyone advice?

Many thanks

Richard


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