[Zope-dev] ZPatterns: SkinScript semantics

2001-01-20 Thread Steve Alexander

In a SkinScript COMPUTE statement, should I be allowed to supply 
different names in the OTHERWISE LET section as in the attributes section?

For example:

WITH some_query() COMPUTE
   foo,bar,baz
OTHERWISE LET
   foo='There is no foo',
   spoon='There is no spoon'


Looking at the ZPatterns code, I don't think this attribute provider 
will get registered for providing "spoon", although "spoon" will get 
calculated if foo, bar or baz is requested.

On the other hand, you could consider the above as a shorthand for:

WITH some_query() COMPUTE
   foo,bar,baz,
   spoon=NOT_FOUND
OTHERWISE LET
   foo='There is no foo',
   spoon='There is no spoon'

In which case, it works entirely as expected.


--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net




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




[Zope-dev] ZPatterns patches

2001-01-20 Thread Steve Alexander

I've put an extensive patch to ZPatterns 0-4-3b2 here:

   http://www.cat-box.net/steve/ZPatterns.patch

The patch includes the following:

* Fix to _memento class so it works with Zope 2.3

* Alteration to GAPMixin so the the attributes it says it provides come 
from the union of the assignments and the defaults.

* Add style="width: 100%;" to SkinScript edit textarea, in line with 
other zope textareas.

* Add syntax to SkinScript "INVALIDATE FOR". You can put an optional 
invalidate-for clause at the end of a compute statement. This causes the 
attributes provided by the statement to be invalidated from the 
dataskin's attribute cache when any of the attributes named after 
INVALIDATE FOR change. It is easier to demonstrate than to explain :-)


There's also an updated PlugIns/www/main.dtml file at:

   http://www.cat-box.net/steve/main.dtml


An example of the new SkinScript syntax:

WITH SELF COMPUTE
   name='%s %s' % (forename, surname)
INVALIDATE FOR
   forename, surname

This is useful if you're providing attributes from another DataSkin. 
Here's an example from some school management software. This is an 
attribute provider for Pupils. A Pupil may have an Instructor. This is 
implemented by the attribute instructor_id of Pupil.

# the instructor is only valid if the pupil is current
WITH SELF COMPUTE
   has_instructor=instructor_id or 0 and current and 1

# don't use has_instructor below, or the instructor details for
# cataloging won't get updated when the assigned instructor changes
# from no instructor to having an instructor.
WITH self.instructor_id and self.current and
   Instructors.getItem(self.instructor_id) or NOT_FOUND COMPUTE
   instructor_name=name,
   instructor_name_link='a href="%s"%s/a' %
 (absolute_url(), html_quote(name)),
   instructor_sort_key=sort_key,
   instructor=RESULT
OTHERWISE LET
   instructor_name='no instructor',
   instructor_name_link='no instructor',
   instructor_sort_key='',
   instructor=_.None


The problem here is that I can't use has_instructor in the WITH clause, 
if I'm also using has_instructor in the same transaction as I'm updating 
instructor_id. I have to use "self.instructor_id and self.current" 
instead, as above.

However, with the new syntax, I don't have to worry about that:

# the instructor is only valid if the pupil is current
WITH SELF COMPUTE
   has_instructor=instructor_id or 0 and current and 1
INVALIDATE FOR
   current, instructor_id

WITH has_instructor and Instructors.getItem(self.instructor_id)
   or NOT_FOUND COMPUTE
   instructor_name=name,
   instructor_name_link='a href="%s"%s/a' %
 (absolute_url(), html_quote(name)),
   instructor_sort_key=sort_key,
   instructor=RESULT
OTHERWISE LET
   instructor_name='no instructor',
   instructor_name_link='no instructor',
   instructor_sort_key='',
   instructor=_.None


Thanks to PJE for pointing me in the right direction on how to implement 
this.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net



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




Re: [Zope-dev] Import/Export in 2.3beta2

2001-01-20 Thread Christopher Petrilli

The reason it's gone is that it's not really a "view" of hte folder, but an
action.  It is, however, a bug that the button doesn't show up if the folder
is empty.  I'm quite sure Brian will fix this ASAP.

Chris
--
| Christopher Petrilli
| [EMAIL PROTECTED]
- Original Message -
From: "Andy McKay" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 19, 2001 6:42 PM
Subject: [Zope-dev] Import/Export in 2.3beta2


 Is this a stupid question, or why cant i Import/Export into a folder in
2.3
 b2 (Windows), there seems to be no tab...

 --
   Andy McKay.




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




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




[Zope-dev] Added rename to ZOPE FTP server

2001-01-20 Thread Tom Vijlbrief

Hi,

I've added the rename capability to the Zope FTP-server,
so I could use the KDE FTP client (this is a known Zope bug).

I attached the 3 modified files (from the 2.2.5 src distro).

There is however another problem in the ZOPE ftpd which
is probably not related to my patches, but for which I have
not found the cause.

The SIZE command (used by the KDE ftp-client as a 
kind of file-exists probe)
reports the size of identical named objects
higher in the tree, to reproduce:

copy with the KDE FTP client a directory tree which has
fileabc in the top directory and a file "fileabc" in a subdirectory
to the Zope ftp server.

The SIZE command returns a size (for a
non existing object!) but the LIST command works o.k.
(reports an error: could not list directory)


127.0.0.1:3771 == mkd testdir
127.0.0.1:3771 == 257 MKD command successful.
127.0.0.1:3771 == mkd testdir/adir
127.0.0.1:3771 == 257 MKD command successful.
127.0.0.1:3771 == type I
127.0.0.1:3771 == 200 Type set to Binary.
127.0.0.1:3771 == SIZE testdir/fileabc
127.0.0.1:3771 == 550 Error getting file size.
127.0.0.1:3771 == type I
127.0.0.1:3771 == 200 Type set to Binary.
127.0.0.1:3771 == SIZE testdir/fileabc.part
127.0.0.1:3771 == 550 Error getting file size.
127.0.0.1:3771 == type I
127.0.0.1:3771 == 200 Type set to Binary.
127.0.0.1:3771 == PASV
127.0.0.1:3771 == 227 Entering Passive Mode (127,0,0,1,14,190)
127.0.0.1:3771 == stor testdir/fileabc.part
127.0.0.1:3771 == 150 Opening Binary connection for
testdir/fileabc.part
127.0.0.1:3771 == 226 Transfer complete.
127.0.0.1:3771 == RNFR testdir/fileabc.part
127.0.0.1:3771 == 350 RNFR command successful.
127.0.0.1:3771 == RNTO testdir/fileabc
127.0.0.1:3771 == 250 RNTO command successful.
127.0.0.1:3771 == SITE CHMOD 644 testdir/fileabc
127.0.0.1:3771 == 500 'SITE': command not understood.
127.0.0.1:3771 == type I
127.0.0.1:3771 == 200 Type set to Binary.
127.0.0.1:3771 == SIZE testdir/adir/fileabc
127.0.0.1:3771 == 213 2
127.0.0.1:3771 == cwd testdir/adir/fileabc
127.0.0.1:3771 == 550 No such directory.
127.0.0.1:3771 == type A
127.0.0.1:3771 == 200 Type set to ASCII.
127.0.0.1:3771 == PASV
127.0.0.1:3771 == 227 Entering Passive Mode (127,0,0,1,14,192)
127.0.0.1:3771 == list testdir/adir/fileabc
127.0.0.1:3771 == 550 Could not list directory. 

-- 
Tom Vijlbrief   [EMAIL PROTECTED]
 FTPRequest.py
 FTPServer.py
 ftp_server.py


[Zope-dev] Better test case for Bug 1783: Persistent __call_method__() interferes with __getstate__

2001-01-20 Thread John D. Heintz

Hello all,

The following is the best test case I have so far for bug 1783.

The behavior of the bug is that no CMethods from Persistent can be 
called indirectly when the __call_method__ hook is present.  This means 
that I can't override any of __getstate__, __setstate__, _p_deactivate.

#!/usr/bin/python
import ZODB
from Persistence import Persistent

class P(Persistent):
def __call_method__(self, meth, methArgs, methKW={}):
return apply(meth, methArgs, methKW)

p = P()

p.__getstate__()

#This throws exception!
Persistent.__getstate__(p)


TypeError: function requires exactly 0 arguments; 1 given


-- 
. . . . . . . . . . . . . . . . . . . . . . . .

John D. Heintz | Senior Engineer

1016 La Posada Dr. | Suite 240 | Austin TX 78752
T 512.633.1198 | [EMAIL PROTECTED]

w w w . d a t a c h a n n e l . c o m


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




Re: [Zope-dev] Added rename to ZOPE FTP server

2001-01-20 Thread Joachim Werner

Tom Vijlbrief wrote:

 Hi,
 
 I've added the rename capability to the Zope FTP-server,
 so I could use the KDE FTP client (this is a known Zope bug).
 
 I attached the 3 modified files (from the 2.2.5 src distro).
 
Dear people at DC! Please get that into the CVS ASAP. This is a very big 
issue for Linux users! (I reported this bug right after KDE2 came out)

Cheers

Joachim




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




[Zope-dev] MS-SQL Server Connector

2001-01-20 Thread Adrian Hungate

Is there a database connector or similar for MS-SQL Server that might run on
non-windows Zopes?

Adrian...


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




Re: [Zope-dev] LoginManger: multiple LoginMethods

2001-01-20 Thread Phillip J. Eby

At 06:38 PM 1/7/01 -0800, John Eikenberry wrote:

Anyways... I want to be able to support both cookie based auth and basic
auth. With cookie based auth being the default unless they don't have
cookies (either because they have them turned off, behind a proxy filter,
etc), in which case they should use basic auth. The problem is I'm not sure
how to get it to use something other than cookie based auth. The default
setup tries to use cookie auth whether or not cookies are in use.

Any tips on how to get this working? I know there is no great way of
detecting cookies, besides setting one and testing for it. But even if I
did this, how do I say I want basic auth if the test cookie isn't found.


Doing a: raise "Unauthorized" or RESPONSE.setStatus(401) will tell the
browser to pop up an authorization dialog.  Note that if you do this, you
won't be able to also display a login form for cookies.

For all practical purposes, you need a seperate login page for cookies vs.
basic auth.


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