[Zope-dev] {Spam?} Re: [Zope3-dev] Re: RFC: TALES adapters and TAL/Tales variable namespaces

2004-05-24 Thread Steve Alexander

Of course, Steve suggested:
  ob:adaptername   context:dc/title

This really doesn't make sense. To me it reads In the namespace of
context get the title of dublin core.
I'm not reading : as having anything to do with namespaces.  Rather, I 
see '/' as the traverse operator, and : as the adapt operator.

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


Re: [Zope-dev] Re: [ZCM] [ZC] 869/ 5 Comment Broken transactionhandling in case of exceptions

2003-04-04 Thread Steve Alexander

I am not in line with your principle the error report is
part of [the output of] the first transaction. 
The error report tells you what went wrong. You can only generate an accurate 
report if you see the objects in the error state.  Zope is saying to your 
application: your transaction is doomed. tell me why.
I'm interested in this for Zope 3.

Currently in Zope 3, you can register a view to give a custom 
presentation of an error that reaches the publisher. The view can also 
do persistent work if it needs to. An example of this is recording 
against a User record that a login failed for that User.

The view has access to the original request that ended in the error. The 
view is looked-up and rendered in a new transaction. The new transaction 
is committed if there were no errors raised, otherwise it is aborted.

Do you think this error handling system is insufficient for your needs?

Can you give an example of the kind of situation where you'd need access 
to objects in a doomed transaction in their doomed state, in order to 
make an error report?

I'm interested in improving the error handling system in Zope 3, so your 
use-case will be very useful.

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


Re: [Zope-dev] Create top-level folder

2003-03-31 Thread Steve Alexander
Matt Ficken wrote, to both [EMAIL PROTECTED] and [EMAIL PROTECTED]:

Part of my product's job is to create a top-level folder. Currently,
I can only get it to create the folder in what ever folder the
product is added in. I would like to be able to get access to the
root directory object but don't know how.
How do I access the root directory object? Would 'getPhysicalRoot' do
that? If yes, how do I use it?
Matt,

Please don't post a message to both [EMAIL PROTECTED] and [EMAIL PROTECTED]

You'll see this at the bottom of each message on the [EMAIL PROTECTED] list:

  ___
  Zope-Dev maillist  -  [EMAIL PROTECTED]
  http://mail.zope.org/mailman/listinfo/zope-dev
  **  No cross posts or HTML encoding!  **
The question you are asking should be asked on [EMAIL PROTECTED], not 
[EMAIL PROTECTED] Andreas was kind enough to answer, but please do try 
the [EMAIL PROTECTED] list first.

The [EMAIL PROTECTED] list is for discussing the development of Zope and 
its internals, not for discussing how to use Zope and its API.

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


Re: [Zope3-dev] Re: [Zope-dev] How (in)secure is Zope?

2003-03-13 Thread Steve Alexander

So I think we can reliably say that stock Zope is secure.  An insecure 
product, on the other hand, opens up many possibilities, but that ought 
to be the subject of a different discussion.
...and if we do have that discussion, can it please be on 
[EMAIL PROTECTED], and not cross-posted to both [EMAIL PROTECTED] and 
[EMAIL PROTECTED]

Unless the discussion is about Zope 3 products, in which case it should 
be on only [EMAIL PROTECTED]

--
Steve Alexander


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


Re: [Zope-dev] How (in)secure is Zope?

2003-03-13 Thread Steve Alexander

I suspect most people with checkin privelidges dont know about this problem, 
because it wont have been sent to the public mailman list.
Perhaps an email can be sent out saying

  Issue number 1234.
  Temporarily restricted pending security review.
  http://url.to.get.it.if.you.are.logged.in
Then, I'd be able to follow the link, authenticate, and read the issue.

--
Steve Alexander


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


Re: [Zope] Re: [Zope-dev] Proposed installation changes for review

2003-03-11 Thread Steve Alexander
 But lo, still you won't be able to do something as
mundane as limit the memory the FTP server is able to consume without
affecting the HTTP server.
You can do this with Zope. Just use ZEO and run one ZEO front-end for 
HTTP and one for FTP.

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


Re: [Zope-dev] ZODB: Are all handles closed?

2003-03-07 Thread Steve Alexander
Ulla Theiss wrote:
Hello list,

in our product (and additionally in an other process) we use separate
ZODB-Storages.
Opening and closing the ZODB several times the number of file-handles
increases.
You might want to post this to [EMAIL PROTECTED] instead of 
[EMAIL PROTECTED]

Also, be sure to say what version of python and zodb you are using.

--
Steve Alexander


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


Re: [Zope-dev] Re: [Vote] PEP308 voting began

2003-03-06 Thread Steve Alexander

(Tested with
div tal:replace=if:options/x then:string:yes else:string:no)
There are an awful lot of colons in there :-)

Here's an off-the-wall idea:

  div tal:replace=talif
   tal:if=options/x
   tal:true=string:yes
   tal:false=string:no
   
This looks better as a tal:tag

  tal:block
  replace=talif
  if=options/x
  true=string:yes
  false=string:no
  
Or, if you only use this kind of thing with tal:replace, tal:content and 
tal:define.

  tal:block
  defineif=foo options/x
  true=string:yes
  false=string:no
  
Of course, none of this helps for tal:attributes.

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


Re: [Zope-dev] ZPublisher XMLRPC extension for user exceptions (II)

2003-02-28 Thread Steve Alexander

By that way, I could send my own fault code and fault descriptions
via XML-RPC.
But as you can see, I have to extend ZOPE code, and I don't want to
do it, I have to work with standard releases of ZOPE.
Do you think that something like that would be improved in an early
future for next ZOPE releases?
Any opinion will be really appreciated.
This is easy to do in Zope 3. You just provide an XML-RPC view for your 
exception that returns the things you want.
Different exceptions can have different views.
The same exception can have a different view for plain browser-oriented 
HTTP, for FTP, and for XML-RPC.

If the views part of the Zope 3 component architecture gets 
back-ported to Zope 2, then you'll be able to use this with Zope 2.

Zope 3 has had only one alpha release, and is still undergoing a lot of 
change and further development. The mailing list for discussing it is 
[EMAIL PROTECTED]

--
Steve Alexander


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


Re: [Zope-dev] Following the Zope Collector

2003-02-26 Thread Steve Alexander

So I'd like to propose to switch the Zope collector to dispatcher Off.
This would mean more email traffic for the supporters, but it's easy
enough to filter and I think the benefits are worth it.
I get my notifications by subscribing to this list:

http://mail.zope.org/mailman/listinfo/zope-collector-monitor



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


Re: [Zope-dev] Security-Problem

2003-02-19 Thread Steve Alexander

Shane Hathaway [EMAIL PROTECTED] wrote:

Do you not want foo to have the Manager role?


Andre Schubert wrote:

No, because he is no longer in our company.


Shane Hathaway [EMAIL PROTECTED] wrote:

I think you're asking for a find + chown utility, right?  I don't know 
of one, but it sure would be nice to have. :-)

Andre Schubert wrote:

It would be very nice to have such a tool :)

BTW: Thanks for the quick answers, you help me to understand the problem.
 I take the ownership of all objects where foo was the owner
 and the problems should go away :)


Andre,

Don't treat this so lightly! When you take ownership of objects where 
foo is the owner, you are telling Zope that you take responsibility for 
those objects.

For example, let's say foo had written a python script for removing all 
of her files older than one day.

Here's some pseudocode:

  For all files older than one day:
try:
  remove the file
except PermissionError:
  pass

This will work, provided foo has rights to delete only foo's files.
If you take ownership of such a script, and you run it, then it will 
very different effects.

Also, if you are a Manager (or in another privaleged role), and you take 
ownership of such a script, you may be allowing others to delete their 
own files when they run that script, whereas before nothing much would 
have happened.


In 99% of cases, none of this will be a problem. However, you should 
take care when taking ownership of objects, especially objects that 
represent code such as python scripts and dtml methods and page templates.

--
Steve Alexander


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


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Tim McLaughlin wrote:

According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters do 
not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?

In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

--
Steve Alexander



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


Re: [Zope-dev] property type

2003-02-06 Thread Steve Alexander
Steve Alexander wrote:

Tim McLaughlin wrote:


According to docs and testing (in the interpreter) I can make a 
read-only calculated attribute using property() (I know that setters 
do not work w/ non-new-style classes).  So I tried the following:

class CMixin:
  def getter(self):
return 'test'
  prop = property(getter)

and when I try to mix in this object w/ a Folder object, the instance 
returns property object at 0x8b45edc for the 'prop' attribute.  Is 
this an issue with pickling or something else?


In Zope 2, the ExtensionClass that is the C base class used for 
Persistent classes, doesn't work with python 2.2 properties.

But, you can use a ComputedAttribute to get much the same effect.

--
Steve Alexander



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


Re: [Zope-dev] [Bug] Zope's transaction behaviour flawed

2003-02-03 Thread Steve Alexander
Chris McDonough wrote:

I am +1 on this.  I suspect that before committing, though, we should
 ask people who make use of Zope's transaction manager in advanced
ways like Phillip Eby.


As I noted in the Collector issue, I believe this change is a good idea
overall. As Chris suggests, we should take note of users of ZPatterns 
and TransactionAgents (and other add-ons?), as these do things at 
transaction boundaries such as clear computed fields. The error handlers 
currently in use may expect these computed fields to be still available.


By conincidence I'm implementing something similar for error handling in 
Zope 3 right now.

Here's the kind of thing I'm doing in zope 3, using the same notation 
Dieter used. First, the simple case where the error handler will 
definitely not need to alter any state:

  ## request starts
  transaction.begin()
  try:
  object= REQUEST.traverse(...)
  result = mapply(object,...)
  transaction.commit()
  except:
  try:
  try:
   result = handle_error()
  except:
   result = default_handle_error()
   # Zope's default error handling
   # it must not have side effects
  finally:
  transaction.abort()
  request.response.setBody(result)
  ## request ends

If there's an exception handler that has side-effects, it must 
explicitly say so, and we get this:

  ## request starts
  transaction.begin()
  try:
  object= REQUEST.traverse(...)
  result = mapply(object,...)
  transaction.commit()
  except:
  try:
  try:
   # this call returns a special
   # 'I have side-effects' token.
   result = handle_error()
  except:
   result = default_handle_error()
   # Zope's default error handling
   # it should not have side effects
  finally:
  transaction.abort()

  if result is I_HAVE_SIDE_EFFECTS:
  transaction.begin()
  transaction.note('%s (application error handling)'
   % '/'.join(object.getPhysicalPath))
  try:
  result = handle_error_with_sideeffects()
  transaction.commit()
  except:
  try:
  result = default_handle_error()
  # Zope's default error handling
  # it should not have side effects
  finally:
  transaction.abort()
  else:
  request.response.setBody(result)
  ## request ends

--
Steve Alexander


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


Re: [Zope-dev] [Bug] Zope's transaction behaviour flawed

2003-02-03 Thread Steve Alexander
Chris McDonough wrote:

I am +1 on this.  I suspect that before committing, though, we should
ask people who make use of Zope's transaction manager in advanced ways
like Phillip Eby.  

I've spoken to Phillip Eby, and he sees no problem with the approaches 
we've discussed.

So, +1 from me.

--
Steve Alexander



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


Re: [Zope-dev] 2.6.1b2?

2003-01-27 Thread Steve Alexander


Here's the status - an engagement that we're doing has been bringing
up some issues regarding ZODB and ZEO in large-scale environments. I
think that the fixes are useful enough that they should be in 2.6.1,
but getting them finalized has taken longer than I expected.


I'd love to know what kind of thing 'large-scale' implies here, and what 
kind of problems the fixes fixed.

--
Steve Alexander


___
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] Re: [Zope-Checkins] CVS: Zope/lib/python/TAL -TALInterpreter.py:1.69.6.10

2002-12-24 Thread Steve Alexander


The problem occurs where you want include the value of a variable inside an
attribute.

For example:

input type=string tal:attributes=value someValue

By default Page Templates replaces the escaped value in the form, unless
structure is specified. If someValue contained a  (eg: test with a 
quote) then you would get the following invalid html (this is what you
currently get):

input type=string value=test with a  quote

This of course should be (and what the patch changes it to):

input type=string value=test with a quot; quote

If you do not escape double quotes in the Page Template html quoting
function, you will never be able to easily use Page Templates unless you are
sure that someValue does not have double quotes escaped. This would mean
having to import an escaping function into your page templates or adding an
extra layer of python involved for almost every use of a variable.


I think page templates should escape quotes in tal:attributes, but not 
under other circumstances.

Also, I believe that an alternative in the example you give would be to 
use single quotes. This is consistent with how quoteattr works:

 from xml.sax.saxutils import quoteattr
 print quoteattr('foo bar')
'foo bar'
 print quoteattr(foo' bar)
foo' bar
 print quoteattr(foo' bar)
foo'quot; bar


quoteattr only resorts to using quot; when there is no alternative -- 
that is, when the string being quoted contains both a single quote and a 
double quote.

So, perhaps an alternative fix would be to revert the current fix, and 
instead make tal:attributes use quoteattr.

--
Steve Alexander


___
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] Re: [Zope-Checkins] CVS: Zope/lib/python/TAL - TALInterpreter.py:1.69.6.10

2002-12-23 Thread Steve Alexander
Andy McKay wrote:

Collector number 735: http://collector.zope.org/Zope/735

This was prompted by some bugs people found with Plone. For a two character
fix that to me looked like a simple oversight I didn't bother with a unit
test.


I'm not going to comment on whether or not page templates should work 
this way.


There good reasons to write a unit test in just this kind of situation:

It is only a two character fix. So, someone else might come along later, 
and think that those two characters shouldn't be there -- just as you 
think those two characters should be there. They could remove those 
characters, and no tests would fail.

Also, in a refactoring, this behaviour couild be easily lost if there is 
no unit test to demonstrate correct behaviour.


--
Steve Alexander


___
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] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander
Guido van Rossum wrote:

Can we get the same patch without the generic except:, please?


snipped part about whether there could be database corruption


int() happens to raise a bunch of different exceptions, and I think
an unqualified except: clause is okay here (though it needs a
comment).


I think this would be a useful note for the Zope3 style guide.


What exceptions can int() raise?

On converting a preexisting value to an int:

  ValueError, OverflowError, TypeError, AttributeError

  (Any others?)

On converting an instance that implements __int__:

  Anything at all.
  It can even return a non-int value.

On evaluating the expression inside the int() brackets:

  Anything at all.


I would suggest that only the four exceptions I listed first are worth 
catching. The other cases are programming errors.
Of those four exceptions, in this situation, I think you only need to 
catch ValueError. The other cases are application logic errors that I 
think it is counterproductive to catch. If you get one, there is a bug 
in some code, or some template, that should be fixed.


Here's how I produced the errors listed in the first category:

 int('xxx')
Traceback (most recent call last):
  File stdin, line 1, in ?
ValueError: invalid literal for int(): xxx

 import sys
 int(sys.maxint+1)
Traceback (most recent call last):
  File stdin, line 1, in ?
OverflowError: long int too large to convert to int

 int(int)
Traceback (most recent call last):
  File stdin, line 1, in ?
TypeError: int() argument must be a string or a number

 int(AttributeError())
Traceback (most recent call last):
  File stdin, line 1, in ?
AttributeError: AttributeError instance has no attribute '__int__'

--
Steve Alexander


___
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] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander


Anything can raise MemoryError.


Ok. But I don't think regular application code should catch these.



On converting an 8bit string to an int:

 ValueError *only*


Ok.


On converting a Unicode string to an int:

 ValueError
 UnicodeError (or UnicodeEncodeError, which is a subclass of it)


Can you provide an example of raising a unicode error like this:

  u = makeUnicodeString()  # your choice of function
  int(u)

My point is that once you have a valid unicode object, I don't see how 
calling int(valid_unicode_object) will raise a UnicodeError.

If this is so, then the style should be:

  value = expression_to_compute_value
  try:
  i = int(value)
  except ValueError:
  # take corrective action

rather than:

  try:
  i = int(expression_to_compute_value)
  except:  # Note: calling 'int()' can raise just about anything
  # take corrective action


--
Steve Alexander



___
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] BUG: ValueError while changing height of the templateedit window

2002-12-11 Thread Steve Alexander
I spoke too soon.  UnicodeEncodeError is a subclass of ValueError.  So
catching ValueError from int(str_or_unicode) is the way to go.  Who's
writing that Zope 3 style guide again?


Great.

http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ZopePythonStyleGuide

--
Steve Alexander


___
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] KeywordIndex and PersistentList (Bug?)

2002-11-25 Thread Steve Alexander
Jeremy Hylton wrote:


JPS == Jeffrey P Shell  writes:


  JPS What about ``if callable(aq_base(newKeywords)):`` to remove
  JPS potential acquisition wrappers?

callable() returns True for any instance.


Any instance of what?


[steve@localhost]$ python2.2
Python 2.2.2 (#1, Oct 31 2002, 10:45:23)
[GCC 2.96 2731 (Red Hat Linux 7.2 2.96-108.7.2)] on linux2
Type help, copyright, credits or license for more information.
 callable(object())
0
 class Foo:
...   pass
...
 callable(Foo())
0



--
Steve Alexander


___
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] Dynamically altering Product methods

2002-11-21 Thread Steve Alexander


* It is my understanding (after long analysis of the source) that
what I'm doing with self._security is okay. I mean, it seems to me I
should be able to redeclare my permission settings at run-time. Is
this correct, or am I missing something? Acquisition is still rough
to me. 


This has little to do with acquisition. I have no idea what 
declareStaticPermissions(self._security) does.

ClassSecurityInfo applies to classes. You're trying to apply it to an 
object -- the 'self' argument of your method. I would not expect this to 
work properly. If it works at all, I'd expect it to re-apply security 
directives to the class (that is, to all of your objects), not the one 
object you want to apply this to.


When do you need this web services stuff to work? All of this is very 
much easier in Zope 3. You can customise the permissions for individual 
objects, and create persistent classes.

Of course, Zope 3 isn't ready for general use yet...

--
Steve Alexander


___
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] KeywordIndex and PersistentList (Bug?)

2002-11-20 Thread Steve Alexander
Thomas Guettler wrote:


Hi!

In KeywordIndex the newKeywords get called
if they are callable:
def _get_object_keywords(self,obj):
newKeywords = getattr(obj, self.id, ())
if callable(newKeywords):   # (*)
			newKeywords = newKeywords()
if hasattr(newKeywords,'capitalize'): # is it string-like ?
newKeywords = (newKeywords, )
return newKeywords

This fails if the newKeywords are stored in a PersistentList.

Callable is true, but there is no __call__ attribute.

I changed the line marked with (*) to
 if hasattr(newKeyword, __call__):

and this seems to work

I think this does not break anything and could be included in the
original.

Am I the first how uses PersistentList for an indexed attribute? Is
there a reason not to do so?



The KeywordIndex should be changed to check for the __call__ attribute, 
rather than relying on 'callable'. You cannot reliably use 'callable' 
when you're also using acquisition wrappers.

See my comment to this Collector report.

  http://collector.zope.org/Zope/578

I suggest you report the bug you have found in the Collector.

--
Steve Alexander




___
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] Production System Specs

2002-11-18 Thread Steve Alexander
Brian R Brinegar wrote:


Hello,

Can anyone point me at some recommended setups for a ZEO cluster. I would
like some or all of the following information:

 * Hardware Specs
 * Load Balancing
 * Caching Information (Apache / Squid Caches)

Any information would be very helpful.


http://www.zope.org/About

--
Steve Alexander


___
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] Securing login with SSL via RESPONSE?

2002-11-18 Thread Steve Alexander
Assume I make a hypothetical SSLRedirect product, modelled on 
CookieCrumbler. There is no reasonable way to keep them in the same
folder and make sure that SSLRedirect gets to the REQUEST/RESPONSE
before CookieCrumbler, correct? I.e. such SSLRedirect product would
have to be in a subfolder relative to CookieCrumbler so that it gets
traversed first.

If you need both CookieCrumbler and this new behaviour, you could derive 
your product from CookieCrumbler. This would ensure that things happen 
in the correct order.

--
Steve Alexander


___
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: [ZODB-Dev] Re: [Zope-dev] Contents of Initial Data.fs in ZopeDistribution?

2002-11-14 Thread Steve Alexander
Casey Duncan wrote:

 It is only there due to lack of time to take it out. We had planned to
 take it
 out for 2.6, but time was never made to replace it with code to
 bootstrap an
 empty storage with the proper root level elements still residing in
 Data.fs.in.

IIRC, the proper root level elements are now created in code.
However, various unit tests of zope and 3rd party products rely on
having a Data.fs.in.

--
Steve Alexander




___
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] bug in mapply.py?

2002-11-05 Thread Steve Alexander


I must admit to not understanding why this should only break over
xmlrpc and not directly from Zope.  The problem appears to be that my
method is defined something like:

def method(self, *args, **kw)


mapply doesn't put things into **kw arguments of methods.

I wanted this once for a product in Zope 3, looked deeply into mapply, 
and talked to Jim Fulton about it.

IIRC, Jim said that mapply shouldn't put things into **kw arguments 
because it isn't at all explicit, and would end up implicitly putting in 
a whole bunch of things that you generally wouldn't want in a lot of cases.


Can you make up a simple python module to demonstrate your case, just 
using a method, and mapply?

It may be that there's a way to achieve what you want, while still 
keeping things reasonably explicit.

--
Steve Alexander



___
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] How to override __getattr__ and not break acquisition

2002-10-17 Thread Steve Alexander


I perhaps should have clarified that I need to be able to specify the
name of the attributes or methods at run time, so ComputedAttribute
unfortunately won't do the trick as you have to define each
attribute/method you require in the class definition.

ie. I need something like :
def __getattr__(self,attr):
   if name in self.methodlist:
 do something
   return Implicit.__class__.__getattr__(self,attr)

where self.methodlist is a list of strings that may change per instance
and/or at runtime, or itself could be calculated at the time of doing
the __getattr__ (eg self.getMethodList()).


Sounds like you could use ZPatterns.

If you do implement your own __getattr__, you might need to check if the 
object you want to return implements __of__, and return 
object.__of__(self) (or something like that).

--
Steve Alexander


___
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] How can I find out who visited a URL within my ZopeProduct?

2002-10-09 Thread Steve Alexander


 If we send an email to a counterparty to a legal contract with a URL to
 the contract, we know that they saw the contract by observing a
 VisitURL Command with their user ID and the URL of the contract.
 That means they read the email and clicked on the URL we sent
 (or navigated to it through some other means).

Correct.

 My application can then automatically send notifications to others
 based on the execution of the VisitURL Command.
 I can send email to my group saying So and so has seen the contract

Incorrect.

 In this particular case, we are writing an invoicing application, so the 
 moment
 the client sees the invoice this way, the Net-30 clock starts ticking

This shows that they read the original email, and intended to view the 
contract at the URL. However, after that point, we only know that Zope 
attempted to send the page at the URL back to the browser. You have no 
proof that such data was ever received by the browser in any way 
meaningful to the end-user. This gets even more complicated when http 
proxies are involved.

--
Steve Alexander


___
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] Plone/Metadata/FUD

2002-10-03 Thread Steve Alexander


  My only response is why wasn't  Many of the components and frameworks 
 currently supplied by the CMF included in the core Zope in the first 
 place?  Everybody has the right to work on their own thing sure.  We 
 would already have a highly extensible Zope3 by now if the time wasn't 
 spent trying to create something else that should have been in the core 
 of Zope in the first place.

If only people could write the ideal software first time!

 From my point of view as a Zope 3 contributor, I'm extremely glad that 
the patterns, use-cases and learning experiences were developed in the 
CMF, outside of the core of Zope.

If what is going into Zope 3 had been worked into the core of Zope 2 
instead of being tried out in the CMF, the speed of development would 
have been an order of magnitude slower, and there would have been a much 
greater risk of increasing the number of deprecated APIs in the Zope 2 core.

So, bravo to the CMF developers and contributors. Not only do we have a 
useful and innovative framework today, we have the blueprints for a 
better Zope tomorrow.

--
Steve Alexander


___
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] form variables and **kw

2002-10-02 Thread Steve Alexander


 If so, why?

I see that Toby and you answered that.


 Is this a python limitation?

No.

 I played around with 
 co_varnames and python doesn't seem to offer a possibility to recognize 
 **kw as something special.

  def foo(bar, **kw):
...   pass
...
  foo.func_code.co_flags
11

  def foo(bar, *args):
...   pass
...
  foo.func_code.co_flags
7

  def foo(bar):
...   pass
...
  foo.func_code.co_flags
3


--
Steve Alexander


___
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] Site-crawler (find unused objects)

2002-08-30 Thread Steve Alexander

[EMAIL PROTECTED] wrote:
 Hi,
 
 has anyone written a script which crawls a site and lists all objects
 which aren't referenced anymore?

Crawling a site means going from a root object, and following all of 
its references, recursively.

Any objects you find through this process are, by virtue of the fact 
they have been found by that process, referenced.
Your requirement is self-contradictory.

--
Steve Alexander



___
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] find unused objects: hopefully the last misunderstanding...:o)

2002-08-30 Thread Steve Alexander

[EMAIL PROTECTED] wrote:
 *  I have lots of scripts, dtml methods etc. everywhere which are
 *  perfectly well-known to the ZODB, nothing wrong with that, but which
 *  are simply not used by me anymore. No usage from other scripts nor
 *  methods nor documents. And these buggers I'd like to find.
 
 * There is no easy way to find such things.
 
 * Especially given acquisition, and the dynamic nature of Zope.
 
 Finally we got it :o)
 
 Ok, the reason for me posting this question was the difficult nature.
 So I take your answer as a 'no' to my original question if anyone has
 already written such a script.
 
 Maybe this would be a good thing to accompany future Zope versions.
 There could be a tab which shows all objects which are called
 explicitely by the actual one in a sortable list.
 
 By the way: is this the correct mailing list for such suggestions?
 If not, which one is it?

You forgot to post my suggestions:


You can use Zope Find to get a list of them, and then manually audit 
them. You could instrument such methods to output logging, and check the 
logs every so often to see what is typically being used.

You could use Zope Find to see if the name of particular methods is used 
within other methods.

--
Steve Alexander


___
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] Proxy Object / __getattr__ / Acquisition

2002-08-29 Thread Steve Alexander

[EMAIL PROTECTED] wrote:
 I am trying to implement a proxy class (specifically for the purposes of
 multi-versioned document objects (folderish proxies that contain the object
 that they proxy to).  I am using __getattr__ within my product, and the code
 pasted below works, and does not break Implicit acquisition (because the
 object that _CurrentVersion points to is subclassed from SimpleItem, which
 implements Implicit Acquisition). However, because of the way that this
 messes with Acquisition, certain things like accessing the ZMI pages or
 acquired methods can be quite slow (but work).  I suspect that this is
 because an instance of this class actually acquires items through the item
 it proxies to, which conveniently is contained inside it, which makes
 acquisition work for the instance of this class (albeit magnitudes slower).
 
 I would really like to make this perform better and act properly, but I'm at
 a loss as to the right way to do this.  Thoughts?
 
 Sean
 
 class MVProxy(Folder):
 
 Object acting as proxy to multiple document
 implementations serving for each version of this
 document; this is a proxy object class
 Subclasses OFS.Folder.Folder
 
 def __init__(self, id, title=''):
 self.id = id
 self.title = title
 timestamp = str(int(time.mktime(time.localtime(
 currentId = id+'_'+timestamp
 current = DocumentCoreImpl(currentId, title)
 self._setObject(currentId, current)
 self._CurrentVersion = current
 
 def __getattr__(self, name):
 return getattr(self._CurrentVersion, name)


Can you use __bobo_traverse__ instead of __getattr__  ?

That should make things much faster.

--
Steve Alexander




___
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] Browser Stop Button and Zope REQUESTs

2002-08-28 Thread Steve Alexander

Oliver Bleutgen wrote:

 Mod_perl also seems _not_ to stop a long running script if this script 
 doesn't try to write to the RESPONSE (or whatever they call it). The 
 perl test script I posted does write output, and this causes it to stop. 
 If I try a script with no output, it never gets stopped.
 
 Java servlets also seem only to get stopped automatically if they try to 
 write into the RESPONSE stream of a closed connection. Buffering aside, 
 if you try to output something in a servlet and the connection is 
 closed, you get an exception.
 
 Im my uninformed opinion, Zope should do the same.
 
 Is this possible?

Although Zope has a response stream method of sending information back 
to the client, most things in Zope don't use it.

Instead, the response information is aggregated, converted into a 
string, and then sent back all at once at the sucessful completion of 
the transaction.

These other systems you mention are using the availability of a response 
stream as a surrogate for RESPONSE.isClientConnected(). I'd rather have 
an explicit RESPONSE.isClientConnected().
Although, it would make sense to raise an exception if someone tried to 
write to the Zope response stream, in the rare cases when this does happen.

--
Steve Alexander


___
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] bad bare except in PageTemplateFile.py

2002-07-18 Thread Steve Alexander

Shane Hathaway wrote:
 
 os.stat() raises OSError if the file is not found, in which case mtime 
 should be set to 0.

Surely if the file is not found, that's an error because the 
PageTemplateFile is pointing at a source file that doesn't exist.

I cannot think of any reason I'd want not to be informed that the source 
file for a PageTemplateFile isn't there. That's clearly a programming error.

So, I suggest removing the try: except: clause entirely, and letting 
os.stat() raise its error.

Or, am I missing something here?

--
Steve Alexander



___
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] bad bare except in PageTemplateFile.py

2002-07-18 Thread Steve Alexander

Shane Hathaway wrote:
 
 I vaguely recall having a similar discussion with someone regarding 
 DTMLFile, and we decided it had to ignore missing files, but I don't 
 remember why.

Darn... that'll be just the reason I'm looking for!


 Also, the open() call just below that line will raise an 
 equivalent exception.

For some reason, the code was not getting there when I came across this 
problem. I guess this 'if' expression must have evaluated true.

 if hasattr(self, '_v_program') and mtime == self._v_last_read:
 return

I'm not sure why it would have done so though.

--
Steve Alexander



___
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] Last-modified and bobobase_modification_time

2002-06-18 Thread Steve Alexander

Wei He wrote:
 On Tue, 18 Jun 2002, Oliver Bleutgen wrote:
 
 
Would please go a little bit deeper giving an example what information 
HEAD requests don't pass to the server, although it's beyond this topic.

HEAD requests are required to have no side effects. On the other hand 
they are required to return the same response as GET requests without 
the BODY.
So GET returning another last-modified header than HEAD would be in 
violation of the RFC. This gets worse by the fact that HEAD can be used 
for caching purposes.
 
 
 Totally understood. But the question is what RFC says about the 
 last-modified header. Shouldn't it reflect the latest update? Zope is 
 facing this problem because it handles the HEAD request seperately. 
 Am I right?
 
 I don't see any need to seperately handle the HEAD request. My hacking of 
 the last-modified header is done execpt that HEAD and wget -S returns 
 different headers. I think the last step is to change the HEAD handling 
 routine to the get information from GET. Does anyone have any idea?

If you *really* want to, you can run a HEAD just like a GET, but after 
getting your last-modified and other details, abort the transaction to 
undo side-effects, then return the HEAD response.

I would generally recommend against this, as it may end up being rather 
expensive.

--
Steve Alexander




___
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] Crash Burn with Zope 2.6.0a1 and ZEO 2.0a1

2002-06-18 Thread Steve Alexander

Andrew Sydelko wrote:
 
The errors in the log are all about failures to import specific
modules.  (Let me know if I missed something else.)  

Failed to import class Splitter from module
Products.PluginIndexes.TextIndex.Splitter.ZopeSplitter

When I import Products...ZopeSplitter, I see a module with a Splitter
attribute bound to a function.
 
 
 I don't understand what you're saying here. Do you mean it works
 without complaining for you? In the past I have deleted all the
 Products that were in the Products Control Panel to fix a similar bug.
 Is that the case here as well?

I explained in the Collector how to fix this problem back in March.

http://collector.zope.org/Zope/181

--
Steve Alexander




___
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] Last-modified and bobobase_modification_time

2002-06-14 Thread Steve Alexander

Casey Duncan wrote:
 BTW: This list if for development *of* Zope, the [EMAIL PROTECTED] list is
 better for questions bout developing *with* Zope.
 
 On to your question:
 
 There is no automatic way in which DTML can do this for you. This is
 simply because dtml-var foo doesn't tell Zope what foo is. Is it a
 document or a script that returns something different every time it is
 called or something else? In fact foo might different things at
 different times, if you aquire the template into different contexts.
 
 Anyhow, if you really want to set a Last-Modified header that reflects
 the latest of a group of documents, you can write a python script that
 accepts either a list of names or objects to test. For the latter here's
 a Py script named setLastModTime with a single argument, *objects:
 
 last_mod = objects[0].bobobase_modification_time()
 for ob in objects[1:]:
 last_mod = max(last_mod, ob.bobobase_modification_time())
 context.REQUEST.RESPONSE.setHeader('Last-Modified', last_mod.rfc822())
 return last_mod # for debugging purposes
 
 Then from dtml:
 
 dtml-call expr=setLastModTime(this(), fooMethod, barDocument, ...)

A similar approach would be for each page fragment to set the 
Last-Modified head if either there is no header set, or its own 
last-modified time is later than one that is set.

--
Steve Alexander






___
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] Problem testing CatalogAware class

2002-06-07 Thread Steve Alexander

Vincenzo Di Somma wrote:
 Hi all,
 does someone knows about problems testing CatalogAware subclasses ?
 I have unit tests for my class and work well, but if I subclass also
 from CatalogAware I receive:

Don't use CatalogAware, use CatalogPathAware.

--
Steve Alexander




___
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] How to override __getattr__ and not break acquisition

2002-06-05 Thread Steve Alexander

Erik A. Dahl wrote:
 Ok I need to override __getattr__ in one of my product classes.  I'm 
 sure this is killing acquisition

yes

 but not sure about the persistence 
 stuff (I think this is working).

it will still work

  Is there a way to make this work? 

yes

 Here  is what I'm doing:
 
 def __getattr__(self, name):
if name == 'myattr':
return self.myattr()

if your return value knows about acquisition, you need to it by calling 
__of__:

  def __getattr__(self, name):
 if name == 'myattr':
 return self.myattr().__of__(self)


 I assume that somewhere in the Acquisition code there is a __getattr__ 
 but I can't find it.

it is implemented in C.


--
Steve Alexander




___
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] Zope 3 Installation

2002-06-03 Thread Steve Alexander

Eddie Moench wrote:
 Can someone tell me, how to get the Zope 3 (from the CVS) up and
 running?
 
 After correcting the verify-import (there was a case-problem), I get the
 error message cannot import name Interface by the command from
 Interface import Interface - which is called by many scripts. Does
 anyone had the same problem and knows a solution?

Please describe exactly the steps you took, starting with the command 
you used to check out Zope 3 from CVS.


If you want in-person advice, there are people on the #zope irc channel 
who have successfully installed Zope 3 from CVS.

--
Steve Alexander



___
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] Re: Zope logic

2002-05-31 Thread Steve Alexander

Tim Hoffman wrote:
 
 However the most problems I have had, are with poorly thought out or
 poorly documented object hierarchies, 

You mean class hierarchies.

 so that it is not obvious or clear
 where and when you should override methods, try manage_afterClone some
 time, and I know this isn't an acquisition problem, or overriding some 
 of the default behaviour for FTP methods. The lack of documented
 approach is far worse than the enforced acquisition, IMHO ;-)

You'll like Zope3 then. There is no dependency on class hierarchies. 
The inheritance hierarchies throughout are either very shallow or 
non-existent.

However, none of the power of expressing the affordances of objects is 
lost. Instead, this is expressed through the interfaces an object 
implements, which can be definied either in your class definitions, or 
elsewhere in zcml or in other classes/interfaces.


 If how these things work and how to use them, was well documented,
 then strangeness with acquisition wouldn't be so strange, ie 
 it would be documented and you could get your head around it.

There is only so much complexity that I can handle at a time. Often 
working on what should be an isolated part of Zope2 exceeds that threshold.


 (I think we will be in a much better position with Zope 3)

:-)


--
Steve Alexander






___
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] Zope logic

2002-05-30 Thread Steve Alexander

Toby Dickenson wrote:
 
 My conclusions are:
 
 a. implicit acquisition is dangerous
 
 b. acquisition that searches outside the containment hierarchy is evil.
 
 
 Im not keeping up with Zope 3 development. how does Zope 3 handle 
 acquisition?

There is no implicit acquisition in Zope 3. If there ever is, it will 
only be there as part of a Zope 2 compatibility library.

Generally if you want something to be acquired by content that lies 
below it, you make that something a a View, a Resource, or a Utility, or 
a Service, or some other such thing.

There is also an acquire namespace for paths and URLs. I haven't had 
cause to use that though.

You make a choice as to what you want as Content and what you want as 
behind-the-scenes plumbing.

--
Steve Alexander




___
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] stacks != easy to explain

2002-05-15 Thread Steve Alexander


Adrian Hungate wrote:

Whereas XML attributes, order indeterminisim,


Chris Withers wrote:
 
...Solved by making it absolutely clear what order stuff executes in. If I
 was training people, I'd tell them to write it in that order too...

Don Hopkins wrote:
 You can't make the order of XML attribute execution clear, because they are
 defined as unordered.
 
 If you're using ordered attributes, then you're not using XML.

Indeed, and if your indentation is meaningful in your C source-code, 
you're not using C.

However, that doesn't negate the benefit of a consistent coding style.

--
Steve Alexander




___
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] Re: [ZPT] Order of attribute execution Feature Request

2002-05-10 Thread Steve Alexander

Tim Hoffman wrote:
 
 In addition event handlers in html ie onClick onBlur etc
 are all order independant.
 
 now adding tal: attributes that where order dependant would seem
 to fly in the face of that convention. (Admittedely there are probably
 no strange dependancies that could be introduced with different orders 
 of border, src etc)

Indeed. It isn't just a convention. The order of attributes within an 
XML or SGML tag is explicitly defined not to matter.

Two important properties of attributes within a tag are that they are 
unordered, and they are unique.


http://aspn.activestate.com/ASPN/Mail/Message/xml-dev/666339

--
Steve Alexander



___
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] Can I get rid of standard_template.pt?

2002-05-10 Thread Steve Alexander

Lennart Regebro wrote:
 I'm not using it, and will never use it, so why does Zope 2.5.1 always
 create one for me?
 Grrr. Highly annoying. :-[

 From Zope 2.1.3 (when I started Zopeing), I could write a Python 
Product that expected standard_html_header and standard_html_footer to 
exist.

 From Zope 2.5.1, I can write a Python Product that expects 
standard_template.pt to exist.

--
Steve Alexander




___
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] Don't try to improve or reinvent XML. Stick withthe standard.

2002-05-10 Thread Steve Alexander

Don Hopkins wrote:
 From: Marc Lindahl [EMAIL PROTECTED]
 
You would need something to close off the 'if' statement, otherwise, a
document full of 'if' statements and no 'else' ones could fill up a

 stack
 
needlessly.

What's so bad about that?  The stack wouldn't carry over after
 
 html/html
 
or body/body - couldn't practically more than 1000's - insignificant!
 
 
 If you're not going to use correct XML syntax, which REQUIRES balanced tags,
 then you shouldn't use a syntax that looks like XML but isn't.


I don't think that's what was originally suggested.

I think what was originally suggested is that an 'if' *element* would 
leave something on the interpreter's stack, for use by an 'else' element 
later.

So, the document remains well-formed, but there is a coupling between 
non-contained elements.

--
Steve Alexander




___
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] Re: [Zope] [PATCH] to Zope's Management Interface

2002-04-29 Thread Steve Alexander

Jerome Alet wrote:
 
 Perhaps you could tell me if I have to use the App.Hotfixes interface or
 not when doing such a not-Hotfix thing.


You should certainly not use the App.Hotfixes interface for this.

The App.Hotfixes interface is for registering dynamic patches that will 
become part of Zope in a future release, at which point the dynamic 
patch can be removed.

While you are dynamically extending Zope, I don't think there are any 
plans to incorporate this into the core Zope distribution.

--
Steve Alexander



___
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] Re: [Zope] [PATCH] to Zope's Management Interface

2002-04-29 Thread Steve Alexander

Jerome Alet wrote:
 On Mon, 29 Apr 2002, Steve Alexander wrote:
 
 
You should certainly not use the App.Hotfixes interface for this.

The App.Hotfixes interface is for registering dynamic patches that will 
become part of Zope in a future release, at which point the dynamic 
patch can be removed.
 
 
 ok, so if I understand correctly all I have to do to make a not-hotfix
 product is just do an unconditionnal assignment of my new complete
 main.dtml file to ObjectManager.ObjectManager.manage_main in my product's
 __init__.py file ?
 
 am I right ?


I'm not sure whether that will be sufficient.

If the ObjectManager class has already been initialized, then its 
security declarations will have been applied to the preexisting main 
DTMLFile object.

In which case, you'll have to re-initialise the class, or process your 
own security declarations, or something like that.

Then again, it might just work.

Try it and see.

--
Steve Alexander






___
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] Re: [Zope] [PATCH] to Zope's Management Interface

2002-04-29 Thread Steve Alexander

Hannu Krosing wrote:

As always any comment is very welcome.
 
 Have you thougth of making this a Hotfix instead of patch ?

Please don't call this a hotfix. That term is reserved for products 
that fix important bugs (especially security bugs) in Zope.

A product can dynamically patch things, using the same mechanism as a 
Hotfix. However, use of this mechanism does not qualify a product as a 
Hotfix.

The terms monkeypatch and dynamic patch have been used to describe 
this mechanism. Please use one of these in preference to Hotfix.

--
Steve Alexander



___
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] zope/python question

2002-04-24 Thread Steve Alexander

Dirk Datzert wrote:
 Hi,
 
 I saw in some products a __of__ operator and looked at the python.org
 for a documentation.
 
 I didn't found one.
 
 Can anybody tell me what the __of__ does ?

It creates an acquisition wrapper for the object the method belongs to, 
in the context of the object you pass as the argument.

It is part of the Extension Class package.


 Or tell me a URL for the documentation of the __of__ operator ?

http://cvs.zope.org/~checkout~/Zope/lib/Components/ExtensionClass/doc/Acquisition.stx?rev=HEAD

http://cvs.zope.org/~checkout~/Zope/lib/Components/ExtensionClass/doc/ExtensionClass.stx?rev=HEAD


--
Steve Alexander



___
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] _v_ and ZEO

2002-04-18 Thread Steve Alexander

Florent Guillaume wrote:
 
 Or am I misunderstanding something ? My question really relates to any
 use of _v_ as a cache that can survive on publisher transaction, really.
 Should _v_ never be used like that ?

There's a case to be made for attributes that not persisted (like _v_ 
attributes) and are cleared at transaction boundaries.

--
Steve Alexander



___
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] how bad are per-request-write-transactions

2002-04-18 Thread Steve Alexander

Jeremy Hylton wrote:
CM == Chris McDonough [EMAIL PROTECTED] writes:

 
Completely agreed.  My disagreement is portraying the counter
problem as impossible with the zodb.  I think some people, as
evidenced by some of the responses, are willing to live with the
tradeoffs.  Other people will find managing a log file on disk to
be a more manageable solution.
 
   CM It would be best to make make a dual-mode undoing and nonundoing
   CM storage on a per-object basis.
 
 I'd really like to do this for ZODB4, but it seems hard to get it into
 FileStorage, without adding automatic incremental packing to
 FileStorage.

This might be possible without incremental packing, if the object will 
be of a fixed size.

I'm thinking of a simple counter here, something like:

class Counter(object):

   __slots__ = ['__count']

   def __init__(self):
 self.__count = 0

   def increment(self):
 self.__count += 1

   def getValue(self):
 return self.__count

Now, imagine that Counter was somehow Persistent too. (There would need 
to be a few more _p_... declarations in __slots__, and possibly some 
changes in the persistence machinery to allow for slots based instances 
as well as __dict__ based ones.)

I would naively expect a pickle of Counter instance to always remain the 
same size. Therefore, it could be updated in-place.

Of course, this would break various other nice behaviours of FileStorage.


Another variation on the same theme: have a fixed-size external 
reference instead of the object's pickle. The fixed-size reference 
points to a separate some_object.pickle file which contains the pickle 
for that one object. The some_object.pickle file gets overwritten on 
each update.

--
Steve Alexander





___
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] Re: [Zope] range:min bug in ZCatalogs fo Zope 2.3.2

2002-03-25 Thread Steve Alexander

Andreas Jung wrote:
 Cool... I would not have expected this to work :-)

IIRC, the range fix was one of the last maintenance tasks on the old 
Components/BTree package before it was deprecated in favour of the new 
Zope/BTrees implementation.

--
Steve Alexander





___
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] manage frame change

2002-03-18 Thread Steve Alexander

Lennart Regebro wrote:
 From: Anthony Baxter [EMAIL PROTECTED]
 
What does machine mean? The host running the ZEO server? The host
running the ZEO client? What about those of us who run multiple ZEO
 
 clients
 
on the same machine (multi-cpu, test instances, whatever)...
 
 
 I think it should show the site name, ie, www.torped.se:1006, or
 intranet.torped.se:8080, and so on.
 That would make me know where I was editing all the tim (except when I have
 SiteRoots. I loathe the littl buggers. Grrr). :-)
 
 It is a great idea, seb.

How about making machine configurable per zope / zeo client instance 
via an environment variable. So, I can read something meaningful to me, 
and I won't have to remember exactly which servers I have running on 
which ports.

--
Steve Alexander



___
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] Replaceable types?

2002-03-17 Thread Steve Alexander

Ivo van der Wijk wrote:

 Secondly, can someone give me an example of a Replaceable object?

Any object that doesn't represent a service-kind-of-thing.

The term replaceable is used in the context of acquisition. Making 
things non-replaceable is a way of providing a particular service (say, 
a MailHost), and ensuring that this service will not be inadvertantly 
shadowed by something else (a DMTL Method perhaps) in a higher-up folder.


The concept of replaceable isn't needed in Zope 3, as services are 
kept separate from content.

--
Steve Alexander



___
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] Zope 2.6 planning - call for contributors!

2002-03-01 Thread Steve Alexander

seb bacon wrote:

 I think the use cases driving synchronisation requirements are not yet
 sufficiently understood.  Agreed, it's a feature that many people need,
 but I get the impression it would be premature to include ZSyncer as is
 in Zope without more detailed planning.  On the other hand, there is an
 argument which says, ZSyncer is a good product used by a lot of people,
 let's put it in Zope and deal with any issues after the event.

Yeah... maybe we need a standard Zope Expansion Kit that is a cohesive 
package of products that aren't in the Zope core, but are officially 
sanctioned and versioned and released alongside versions of Zope.

--
Steve Alexander



___
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] Re: Zope vs. Cocoon

2002-02-25 Thread Steve Alexander

Max M wrote:
 seb bacon wrote:
 
 Architecturally, it is *excellent*, and I'm very excited about it.  I
 could wax on for hours, but I won't right now.

 
 
 I only wish somebody would ... It is hard to figure it out fully by 
 reading only the online documentation.

Do the tutorial:

http://cvs.zope.org/Docs/Docs.tar.gz?tarball=1

--
Steve Alexander


___
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] Defining Interfaces

2002-01-28 Thread Steve Alexander

Adrian Hungate wrote:
 This is based on the new Python 2.2 stuff, isn't it? I would guess the
 answer would be You exclude the 'self' first arg in a class method.

Not really. You exclude the self first argument of a static method. 
The first argument of a class method is where the class is passed.

The reason that self is now excluded when defining interfaces comes 
from considering who reads interface definitions.

By their nature, interfaces are meant to be read from the outside; 
from beyond the facade. The self attribute of methods is an 
implementation detail, and is not a concern of those who make calls on 
an interface.

With Python2.2, you can demonstrate this by defining a class that has 
static methods only, but which still satisfies some interface 
definition. The self argument need not occur at all.

--
Steve Alexander


___
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] Defining Interfaces

2002-01-27 Thread Steve Alexander

Hi folks,

When I define an Interface, are the methods of the interface supposed to 
have self as the first argument?

It certainly seems that way from 
./lib/python/AccessControl/IUserFolder.py in Zope2.  It also seems that 
way from the Interface Interface.

However, many of the interfaces in Zope3 omit the self argument.


--
Steve Alexander




___
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] Defining Interfaces

2002-01-27 Thread Steve Alexander

Jeffrey P Shell wrote:
 On 1/27/02 11:25 AM, Steve Alexander [EMAIL PROTECTED] wrote:
 
 
Hi folks,

When I define an Interface, are the methods of the interface supposed to
have self as the first argument?

 
 No.

In which case, perhaps we should change InterfaceInterface and 
InterfaceBaseInterface from Interface/iclass.py to reflect this.

The ZDG should also be updated to reflect this, as the example is wrong.

   http://www.zope.org/Documentation/ZDG/ComponentsAndInterfaces.stx

  from Interface import Base

   class Hello(Base):
The Hello interface provides greetings. 

   def hello(self, name):
Say hello to the name 

   class HelloComponent:

   __implements__ = Hello

   def hello(self, name):
   return hello %s! % name


Shall I throw this into the Collector?

--
Steve Alexander



___
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] Security Gurus Wanted

2002-01-19 Thread Steve Alexander

vio wrote:
 Just a word to thank you for your reply. 
 But incidently, wouldn't it be a good idea for Globals.InitializeClass() 
 to throw an error
 or a warning of some kind for hanging 'security.stuff()' declarations,
 declarations which do not have a related ClassSecurityInfo object AT THE
 CLASS LEVEL? 

That would be a fine idea. Unfortunately, there is no straightforward 
way telling that you called methods on the security object in the class 
definition.

When you call Globals.InitializeClass(your_class), it looks for a 
ClassSecurityInfo object, and doesn't find one.

The fact that your class definition had the side-effect of altering the 
module's security object doesn't leave any traces in the class object 
that results from your definition.

--
Steve Alexander


___
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] Security Gurus Wanted

2002-01-19 Thread Steve Alexander

vio wrote:

deletia

 So Globals.InitializeClass(your_class) finds the declaration 
 'security.declareSomething()' inside a class, but 'security' being
 a reference to a ClassSecurityInfo object AT THE MODULE LEVEL somehow has 
 no effect at the class level (while I wrongly thought that by declaring it
 at the module level like that, it will behave more or less like a 'global'
 variable).

deletia

 In my opinion, Globals.InitializeClass() should check such calls to
 security methods

You appear not to understand how Python and the declarative security 
system in Zope work.

Globals.InitializeClass() does not read the source to your modules. You 
would need some sort of lint tool to perform the checking you describe.


Why not try to implement a simple case of the error-correcting system 
that you describe? You might want to extend an existing lint tool such 
as PyChecker, to take account of conventions used in Zope products.

   http://pychecker.sourceforge.net/

--
Steve Alexander


___
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] increase penis size by an average of 26% sex drive also

2001-12-30 Thread Steve Alexander

River wrote:

 * Extend http://www.cable-descramblers- etc.com/extendprice.html *
 
 Natural formula that is guaranteed to increase
 penis size by an average of 26%. 
 
 * Get RESULTS NOW with *EXTEND http://www.cable-descramblers- 
 etc.com/extendprice.html*! **
 
 ** Thicker **
 
 ** Longer **
 
 ** Confidence-building penis  **
 
 ** Increased sexual stamina **
 
 ** Fullness with every stroke **
 
 ** Deeper penetration **
 
 ** Superior sexual stamina that you and your sexual partner have 
 always imagined **
 
   CLICK UNDERLINED LINK TO RECEIVE INFORMATION  



Please submit this patch to the collector, and I'll see what I can do to 
get it into the Zope core.

--
Steve Alexander


___
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] zope collector is broken

2001-12-10 Thread Steve Alexander

Florent Guillaume wrote:

 Okay it seems fixed, but I wanted to mention a similar user-experience
 problem in CMF and workflows in general:
 
 Suppose a user clicks publish in the action box, enters his comment
 and then clicks the Publish button. And the re-clicks on the Publish
 button (either because he double-clicked, or because he retried because
 the process seemed slow). Then the first click will correctly change the
 object state, and the second click will be unable to publish because
 from the public state there is (obviously) no further publish
 transition. So the user will get a message like the one below.
 
 Because I saw that these double-clicks are somewhat frequent in our
 case, I put a try: except: in content_status_modify.


For one of my applications (not CMF based), I use unique form ids to 
catch if a form is submitted twice.

I also use a bit of javascript to ignore a second click on the submit
button, which reduces the load on the form-ids manager. I'd post the 
javascript... but I can't find it just now. It is just a three-liner  to 
set a variable when the button is first clicked, and only allow the 
submit action to run if the variable is unset.

Actually, now that CST is in the Zope core, I should rewrite the form-id 
manager to take advantage of that.

--
Steve Alexander



___
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] ZPT Plain Text

2001-12-05 Thread Steve Alexander

Chris Withers wrote:


 Chris -- more and more a ZPT-ONLY! fan each day...


How would you email someone some output from the Python interactive 
interpreter?

In other words, how do you get a naked  or  or  in a plain-text ZPT?

I guess you'd need to have a special page template interpreter that 
knows that it isn't putting out SGML-style stuff.

--
Steve Alexander



___
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] absolute_url FTP upload and CatalogAware

2001-12-05 Thread Steve Alexander

Niclas Kuehne wrote:

 When I upload a file of a certain class (HTMLDocument) that is 
 CatalogAware the entry in the catalog does not contain the real 
 absolute_url. Instead it shows 
 http://myserver:21/Zope/Dir1/Dir2/object.html; where myserver is the 
 hostname of the linux server, 21 is the FTP port used by Zope and Dir1  
 Dir2 are directories. When I clear the catalog and add the documents by 
 clicking Find Objects the absolute_url is correct. What is happening 
 here? Any help?


Please don't post in HTML to this mailing list.

Please do not post to both the zope-dev and [EMAIL PROTECTED] lists.



The problem is that you are using CatalogAware. Try using 
CatalogPathAware in its place.

The CatalogAware mixin was written before Zope was improved to cope with 
virtual hosting.

The replacement is CatalogPathAware, with CatalogAware kept around to 
support legacy systems.

--
Steve Alexander



___
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] Open letters, hijacking and the like

2001-12-02 Thread Steve Alexander

Clark O'Brien wrote:
 

 I am hearing to different stories, sometimes from the
 same people.


You obviously care enough about Zope that you continue taking the time 
to post to this mailing list.

Why do you care?


What do you want from Zope? (software, community, corporation; you choose)


--
Steve Alexander





___
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] Open Letter to zope-dev

2001-11-30 Thread Steve Alexander

Lennart Regebro wrote:

 
 What I do agree on is that Zope corp not always seem to *listen* to the
 community. It is hard to contribute to Zope, and it feels to me that you
 have to fight to make Zope Corp to things the right way, even when you in
 fact already have done the work for them. I don't know why that is, or if it
 is possible to change that. I suspect they simply have far too much to do...
 :-)


Does the fishbowl process address this for you?

   http://dev.zope.org/Fishbowl/Introduction.html

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] Open Letter to zope-dev

2001-11-30 Thread Steve Alexander

Lennart Regebro wrote:
 

 Does the fishbowl process address this for you?

   http://dev.zope.org/Fishbowl/Introduction.html
 
 I'm aware of the fishbowl process.


Sorry, I wasn't clear with my question.

Does the fishbowl process address what you said about having to fight to 
get things done the right way, even when you've already produced the 
code, and making up for people's lack of time to do everything?

--
Steve Alexander


___
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] Dataskin Zclass + Folder subclassing problem

2001-11-30 Thread Steve Alexander

Jean Lagarde wrote:

 Thanks Steve,
 
 No doubt that is probably what is happening. Sadly, I need ZClass1 to be
 a dataskin. 


Make both ZClass1 and ZClass2 derive from Dataskin before anything else.

It will do no harm that DataSkin is derived from twice in one class.

--
Steve Alexander


___
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] Fw: [Exuserfolder-devel] Zope 2.5b1 release

2001-11-29 Thread Steve Alexander

A K Milton wrote:


 
 a) The change to manage_* seems to be completely arbitrary, since we already
had _do* methods that meant you didn't have to call manage_users with
fake submit buttons. So what is the point of having manage_ ?


They were added in response to this fishbowl proposal:

http://dev.zope.org/Wikis/DevSite/Proposals/UserFolderXmlRpcQuickFix

It was a quick fix intended to help people doing user management over 
XML-RPC.


If there are problems in maintaining compatibility with the previous 
API, and products that rely on that, well that's a bug and it needs 
Collecting and sorting out before 2.5 final.

I'm concerned about this too, and I'm glad it's reached Zope-Dev, as 
I've got some LoginManager user folders in use, and I don't want these 
to break when I start using Zope 2.5 on those systems.


In the fishbowl proposal comments, Brial Lloyd wrote:

 This is so long overdue that I've just checked this in for the Zope 
2.5 line in CVS. (It is slated for 2.5 because it is an API change and 
has documentation impact, plus I would like to follow up and clean up 
some of the old form dispatch code and want to make sure we have an 
upgrade cycle to make sure other implementations of user folders don't 
break).


I see an intention not to break other user folder products. Given that 
the fishbowl proposal in question is supposed to make for a very small 
change, any breakage in existing products is a bug in its implementation.


In summary:

I want to make sure that things are no worse in Zope 2.5 final than in 
Zope 2.5. Any breakage caused by this API change is a bug, and needs to 
be sorted out by Zope 2.5 final.
I can offer some help in fixing these bugs, especially if they find 
their way into the Collector, so I can take ownership of them.


Improvements to the user folder API that fall outside getting it 
working with XML-RPC bring up larger issues, which I see are being 
discussed here:

http://dev.zope.org/Wikis/DevSite/Proposals/BetterUserManagement


--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] Fw: [Exuserfolder-devel] Zope 2.5b1 release

2001-11-29 Thread Steve Alexander

Steve Alexander wrote:


 In summary:
 
 I want to make sure that things are no worse in Zope 2.5 final than in 
 Zope 2.5. Any breakage caused by this API change is a bug, and needs to 
 be sorted out by Zope 2.5 final.


That should have read:

I want to make sure that the user management API is no worse in Zope 2.5 
than in Zope 2.4.


--
Steve Alexander



___
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] Catalog improvements

2001-11-27 Thread Steve Alexander

Casey Duncan wrote:

 
 I have some code that implements this in my CatalogQuery product. It creates 
 a query object from a string. Presently these are not persistent, but they 
 could easily be made to be to create precompiled queries.
 
 code at: http://www.zope.org/Members/Kaivo/CatalogQuery


Casey, did you get a chance to look at my patches for adding an extended 
uniqueValues method to CatalogQuery?

 
 I would be willing to help both in coding and getting the code put into the 
 Zope core.


raises hand me too!


 
So, if there is interest, i would propose to collect some ideas and
comments about how a better Catalog should look like, how it could be best
implemented and how to organize this effort (with respect to the already
existing proposals).
 
 I am very interested in such a discussion. Let me know what I can do to help.


I'm interested in this too, and I'm keen to get a solution that will 
work with just the ZODB, without needing all of Zope.


--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] SearchIndex deprecation warning

2001-11-21 Thread Steve Alexander

Danny William Adair wrote:


Apparently one or more of my installed (third-party) products is causing
this.



I don't think so.

Try this: delete all filesystem products from the Zope control panel, 
and restart Zope. I think you'll find that the products will return, and 
you won't get these messages at startup.

You're getting these errors because of persistent Catalog objects stored 
by the Zope help system, which were created before Zope 2.4.

--
Steve Alexander
Software Engineer
Cat-Box limited




___
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] Zope 2.4.2 DTML Method Bug

2001-10-31 Thread Steve Alexander

Casey Duncan wrote:

 One of my products exposed a bug in the 2.4.2 version of DTMLMethod.py. It is 
 minor and can be worked around, but I wanted to point it out:
 
 Line 203 of DTMLMethod.py now contains:
 
 del self.__dict__['validate']
 
 which is part of a try...finally statement.
 
 It seems that the validate key is not always present in the object at that 
 point, specifically if you recursively call an object in a different context 
 then it was originally called. as in:
 
 dtml-with name=something
   dtml-return name=this
 /dtml-with
 
 This piece of code resulted in a KeyError on validate in my product code, 
 which had previously worked fine. Perhaps another try statement should be 
 wrapped around this del statement?


This happens when a dtml method is reentrant.

The fix needs to be a bit deeper than what you describe above, otherwise 
you'll potentially lose the validate attribute of the dtml method 
object, and you'll get strange errors.

I've put this into the new collector, with a patch:


   http://new.zope.org/Collector/4

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] login prompt after letting user change his password.

2001-10-27 Thread Steve Alexander

Chris Withers wrote:

 Clark OBrien wrote:
 
It is really confusing for the login to pop up at this point-
particularly because
it looks like it is asking for permissions to change the password (
needs OLD password)

 
 You're asking for Web browser functionaility to be changed, go bug W3C,
 Microsoft, Netscape and any other browser vendor you want to ;-)


You could program something really fancy into the UserFolder that 
continued to allow the old password until the new password has been 
used, or one day has passed.

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] howto: background processes, queued events and ZEO?

2001-10-25 Thread Steve Alexander

Jay, Dylan wrote:

 I have a very computationally expensive task that I need to perform for
 users of my system. The idea is that when they access the page that needs
 the results of this process they will be returned a note saying to wait
 while the calculations are done. The calculation request is queued and
 eventually picked up by a background process and run. Only one calculation
 is run at once.
 
 My current attempt at implementation is using Xron DTML Methods. However
 from looking at the code I gather that this will not scale well if I decide
 to use ZEO (I think every client will have a background dispatcher so the
 task would be run multiple times). Using ZEO I'd like to nominate one or
 more servers to be the workhorses and do all the calculations. Anyone tried
 doing something like this or can suggest the best approach?


I'm doing somthing like this using a long-running python process 
(nothing to do with Zope) that watches various directories for the 
appearance of xml files that tell it what to do.

When it sees new xml files, it processes them in order of last 
modification time. The xml file contains a URL to go to to notify the 
Zope that produced the xml file that processing is complete.

All the information needed to do the calculation is in the xml file, so 
my long running python process doesn't need to know about Zope or ZEO at 
all.


In practice, users request a report from through the web. They are given 
a page saying this may take some time. You will receive an email when 
it is complete, or look at your homepage for a progress indication.

Zope constructs a file in a working directory, and moves it into the 
watched directory. The long running process sees this file, processes 
it, and tells Zope when it is done. Zope updates the user's homepage, 
and sends the user an email.

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] problem to rename folder

2001-10-24 Thread Steve Alexander

Johan Beauce wrote:

 Hello,
 
 I have a little problem. I use this function to rename an object in my site
 (file or folder).
 It work perfectly with file but I have an error when I try to rename a
 folder 
 I think the error is from PARENT[0], so do you have a solution ???
 
 dtml-let objRename=_.getattr(PARENTS[0], _['idName'])
dtml-call
 objRename.manage_renameObjects([idName],[newId],getWay(REQUEST.PATH_INFO))
 
 /dtml-let
 
 Thanks a lot, 
 Johan.


Johan,

You sent this message to the [EMAIL PROTECTED] list and also to the 
[EMAIL PROTECTED] list. Do not do that. Send your message to one mailing 
list only.

Because your message is about using Zope and DTML rather than developing 
the internals of Zope, your should have sent your message to only the 
[EMAIL PROTECTED] list.

 
This email and any files transmitted with it are CONFIDENTIAL and
 intended solely for the use of the individual or entity to whom they are
 addressed. 
 
Any unauthorised copying, disclosure, or distribution of the material
 within this email is strictly forbidden. 


Do you realize that you just sent this email to a public mailing list, 
with archives available on the world wide web?

--
Steve Alexander
Software Engineer
Cat-Box limited




___
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] PageTemplateFile + Metal not working

2001-10-10 Thread Steve Alexander

I'm using ZPT in a Python Product. PageTemplateFile works fine, using it 
more-or-less as a drop-in replacement for DTMLFile.

However, I want to use METAL with this. Simple macros that work on page 
templates created in the ZODB fail to work from filesystem python products.

The error I'm getting is this:

   Error Type: Undefined
   Error Value: macros not found in
 here/standard/macros/header_and_footer

If I call _cook() on the PageTemplateFile objects in my module, I get a 
slightly different error:

  Error Type: Undefined
  Error Value: header_and_footer not found in
here/standard/macros/header_and_footer


This is the latest version of PageTemplates, TAL, and ZTUtils from CVS, 
with the latest Zope trunk from CVS.

Any ideas?

--
Steve Alexander
Software Engineer
Cat-Box limited




___
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] ZTables and/or Catalog plugable brains?

2001-10-05 Thread Steve Alexander

Jay, Dylan wrote:

 (resent to here from [EMAIL PROTECTED] due to complete lack of resoonse. Perhaps
 there should be three levels of mailing list. zope-use, zope-app-dev,
 zope-dev or something)
 
 I'm in the process of of write a zope product that will deal with a lot
 numerical data (records with a few ids and a few float values). Rightly or
 wrongly (comments welcome) I've decided to do this inside the ZODB rather
 than rely on a relation database. This is largely because this data will 
 
 - not be high-write
 - I want to do processing on all this of this data on multiple servers
 - and I am presuming that at some point in the not too distant future zope
 will let me replicate this data very easily to make it even more highly
 available.


Write a Python Product. See the Zope Developers Guide for details.

  http://www.zope.org/Documentation/ZDG/Products.dtml



 Anyone with comments about how ZPatterns fits into all of this would also be
 welcome.


I can't see that it would particularly help you.

--
Steve Alexander
Software Engineer
Cat-Box limited





___
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] Curious problem with comprehensions and PythonScripts

2001-10-05 Thread Steve Alexander

Here's the situation:

I have a dtml document with a list of questions under various headings, 
formatted like this:

HEADING 1
   question1
   question2
   question3

HEADING 2
   question 4
   question 5


I have a PythonScript that gives a list of only the questions to a Page 
Template:

PythonScript called get_questions:

data=container.data_document(None, None)

# ignore blank lines
# lines with no leading space are headings
# lines with leading space are questions

return [l for l in comps.splitlines()
   if l
   if l[0] is ' ']

I'm rendering this using a page template:

td tal:repeat=question container/get_questions


The problem is, I'm often (always?) getting no questions rendered.

However, if I change the python script to this, it works every time.

PythonScript called get_questions:

data=container.data_document(None, None)

# ignore blank lines
# lines with no leading space are headings
# lines with leading space are questions

questions = [l for l in comps.splitlines()
if l
if l[0] is ' ']

return questions



Any ideas what might be happening?

I think the compiled code of the python script might be incorrect when 
directly returning the results a comprehension.

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] Random.shuffle

2001-10-05 Thread Steve Alexander

Any particular reason why you can't use Random.shuffle from a 
PythonScript? Or any other methods of a Random object.


I'd like to propose that restricted python be allowed access to methods 
of random.Random.

I know that I can write a product to add a security declaration to 
random.Random, but I'd like this to be enabled by default in Zope.

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] Random.shuffle

2001-10-05 Thread Steve Alexander

Steve Alexander wrote:

 Any particular reason why you can't use Random.shuffle from a 
 PythonScript? Or any other methods of a Random object.
 
 
 I'd like to propose that restricted python be allowed access to methods 
 of random.Random.
 
 I know that I can write a product to add a security declaration to 
 random.Random, but I'd like this to be enabled by default in Zope.


Surprisingly enough, you can set the global random seed from restricted 
python. That doesn't sound right to me.

dtml-call _.random.seed(42)


-- 
Steve Alexander
Software Engineer
Cat-Box limited




___
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] Curious problem with comprehensions and PythonScripts

2001-10-05 Thread Steve Alexander

Steve Alexander wrote:


 Any ideas what might be happening?
 
 I think the compiled code of the python script might be incorrect when 
 directly returning the results a comprehension. 


Hmmm... it happened again. I think it might have something to do with 
the PythonScript falling out of the ZODB cache.

I've changed the code to a filter(lambda ...) to see if it still happens 
with that.


-- 
Steve Alexander
Software Engineer
Cat-Box limited



___
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] ZCatalog API

2001-10-05 Thread Steve Alexander

E. Seifert wrote:

 Hi list,
 
 as I'm not very familiar with the internals of ZCatalog I have a question to
 all you API experts:
 
 Why does ZCatalog.py (under Zope 2.4.1) specify a 'addIndex' permission for
 a method called 'manage_delIndexes' although there is no such method? The
 only method I could find to delete Indexes is 'manage_deleteIndex'.
 
 Can anyone comment on this?


Thanks for pointing this out. There was some cruft in ZCatalog.py, which 
has now has been cleaned up. The changes are in CVS, and will be in the 
next release of Zope.


The method manage_deleteIndex is still there, but is deprecated, and 
will issue a warning the first time it is called.

You can use manage_delIndex instead.

Both are protected by the addIndex permission.


--

Steve Alexander
Software Engineer
Cat-Box limited




___
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] ZCatalog API

2001-09-30 Thread Steve Alexander

E. Seifert wrote:

 Hi list,
 
 as I'm not very familiar with the internals of ZCatalog I have a question to
 all you API experts:
 
 Why does ZCatalog.py (under Zope 2.4.1) specify a 'addIndex' permission for
 a method called 'manage_delIndexes' although there is no such method? The
 only method I could find to delete Indexes is 'manage_deleteIndex'.
 
 Can anyone comment on this?


Well, considering that there's these methods in ZCatalog:

   manage_addColumn
   manage_delColumns
   manage_addIndex
   manage_deleteIndex

... manage_deleteIndex is obviously the odd one out.

Especially as it allows you to delete several indexes in one go.

I suggest it be renamed manage_delIndices or manage del_Indexes.


manage_clearIndex also operates on multiple indexes, so that should 
become manage_clearIndexes.

Funnily enough, the ZCatalog regression test at
./regressiontests/regressionCatalogTiming.py uses this call:

   manage_delIndexes([x])

which supports renaming manage_deleteIndex to manage_delIndexes.

However,  while dtml/catalogIndexes.dtml uses manage_delIndexes,
./dtml/manageIndex.dtml uses manage_deleteIndex.

manage_reindexIndex should also become manage_reindexIndexes, as it 
requires a sequence of ids. Also, manage_reindexIndex doesn't have an 
associated permission.

There's a few more place this touches, although all the changes are in 
ZCatalog.py and manageIndex.dtml.


Congratulations, you've found a bug!

This would have been more obvious if ZCatalog were using the new 
declarative security assertions, as the declaration would be right next 
to the method definition.


Here's a first-draft patch, for comments etc.
I haven't looked at the documentation of the API, so that might need 
changing too.


--
Steve Alexander
Software Engineer
Cat-Box limited


*** ZCatalog.py.orig
--- ZCatalog.py
***
*** 196,202 
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogIndexes',
'manage_catalogAdvanced', 'manage_objectInformation',
!   
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_addColumn', 'manage_delColumns',
'manage_addIndex', 'manage_delIndexes', 'manage_main',
--- 196,202 
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogIndexes',
'manage_catalogAdvanced', 'manage_objectInformation',
!   'manage_reindexIndexes', 'manage_clearIndexes',
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_addColumn', 'manage_delColumns',
'manage_addIndex', 'manage_delIndexes', 'manage_main',
***
*** 422,430 
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Added')
  
  
! def manage_deleteIndex(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del an index 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
--- 422,430 
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Added')
  
  
! def manage_delIndexes(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del indexes 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
***
*** 436,444 
  if REQUEST and RESPONSE:
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Deleted')
  
! def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  del an index 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
--- 436,444 
  if REQUEST and RESPONSE:
  RESPONSE.redirect(URL1 + 
'/manage_main?manage_tabs_message=Index%20Deleted')
  
! def manage_clearIndexes(self, ids=None, REQUEST=None, RESPONSE=None,
  URL1=None):
!  clear indexes 
  if not ids:
  return MessageDialog(title='No items specified',
  message='No items were specified!',
***
*** 462,468 
  if obj is not None:
  self.catalog_object(obj, p, idxs=[name]) 
  
! def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None, URL1=None):
   Reindex indexes from a ZCatalog
  if not ids:
  return MessageDialog(title='No items specified',
--- 462,468 
  if obj is not None:
  self.catalog_object(obj, p, idxs=[name]) 
  
! def manage_reindexIndexes(self, ids=None, REQUEST=None, RESPONSE=None, 
URL1=None):
   Reindex indexes from a ZCatalog
  if not ids

Re: [Zope-dev] [Bug] DateTime(string) uses GMT as timezone

2001-09-30 Thread Steve Alexander

Dieter Maurer wrote:

 Unfortunately
 
   DateTime(year,month,day) != DateTime(%d-%d-%d % (year,month,day))
 
 The former uses the local timezone (which I think is right)
 while the latter uses GMT+0 (which seems not right).
 
 Thinks are quite bad, as the latter is used to convert
 :date form values into DateTime objects.


See also here:

http://lists.zope.org/pipermail/zope-dev/2001-August/012974.html



I get different times from a string, depending whether I use '-' or '/'
as a date delimiter.

   from DateTime.DateTime import DateTime
   DateTime('2001-08-20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+0'
   DateTime('2001/08/20').pCommonZ()
'Aug. 20, 2001 12:00 am GMT+1'
  

I find the difference a tad surprising.

Is this a bug or a feature?

If it's a bug, I'll work on a fix.

I'm guessing this is a feature; perhaps using the '-' delimiter suggests
I'm trying to use ISO formatting.

I'm running this in a GMT+1 timezone btw.

Zope latest from CVS, Python 2.1.


I never got a reply as to whether it was a bug or a feature, so I didn't 
work on a fix.

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] testing types in PythonScripts

2001-09-28 Thread Steve Alexander

I have a variable, f.

The value of f might be a list, or it might be a string.

I want to do different things to f depending what type it is.

How do I check its type from a PythonScript?


I can't use type(), as this opens up a security hole with Extension 
Classes, where the type is the class.

I can't import types, as that seems to be restricted.


I suggest that either one or both of the following be altered:

  * The types module is allowed to be imported into restricted stuff.

  * A safe version of type() is put into the restricted global namespace.


I seem to recall a discussion of this a few months ago, where someone 
(Evan?) proposed a safe version of type(). I guess this got lost in the 
conversion to RestrictedPython with Zope 2.4.


Oh yeah... an ugly workaround is to try to append to f and see if you 
get and AttributeError.

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] Acquisition, __getattr__ and making a Proxy/Symlink class

2001-09-26 Thread Steve Alexander

Lupus Yonderboy wrote:

 
 Can anyone shed some light on how i might do this? All
 objects under the DocumentRoot will be derived from
 one of our base classes, so if we need to override
 __getattr__ as per TransparentFolders it can be done
 easily.


Have you looked at the __bobo_traverse__ traversal hook?

   http://www.zope.org/Documentation/ZDG/ObjectPublishing.dtml

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] zLog and stderr

2001-09-26 Thread Steve Alexander

Toby Dickenson wrote:

 I have some old python modules which are generating messages from the
 new python 2.1 warning framework. I can easily fix these modules,
 however it has exposed a problem in Zope..

 
  The warning framework tries to write to sys.stderr, and my Zope is
  dying from an exception because stderr has been closed.

I bumped into this with Python 1.5.2, and a print statement in the 
Threading module. This was causing me problems using Xron.

The solution was to use this at the end of the start script:

/some/path/logs/zope_stdout.log 21

I keep a separate script called start_debug that doesn't do this, and 
adds -D to the z2.py switches.


 I think it makes sense that Zope should replace sys.stderr with an
 object that sends messages to zLog, however zLog itself sometimes
 wites to sys.stderr.


I guess it would be nice to specify switches to z2.py to say that stderr 
should go to ZLog, and ZLog's stderr messages should get appended to a 
specified file.

--
Steve Alexander
Software Engineer
Cat-Box limited




___
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] ZCatalog problem: sort_on bug

2001-09-24 Thread Steve Alexander

I'm getting a strange problem with ZCatalog, using python 2.1, Zope from 
CVS.

I get all the results I expect with this:

ul
dtml-in Catalog(process_step=['start','mailed'])

li dtml-subject_name; -- dtml-relationship_name; - dtml-rater_name;

/dtml-in
/ul

But, I only get one subject_name's worth of results with this:

ul
dtml-in Catalog(process_step=['start','mailed'], sort_on='subject_name')

li dtml-subject_name; -- dtml-relationship_name; - dtml-rater_name;

/dtml-in
/ul


This smells like a BTrees bug to me, but I'm not sure. I'm looking into 
this closely now, but if anyone's seen this before, please speak up!

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] ZCatalog problem: sort_on bug

2001-09-24 Thread Steve Alexander

Steve Alexander wrote:

 I'm getting a strange problem with ZCatalog, using python 2.1, Zope from 
 CVS.
 
 I get all the results I expect with this:
 
 ul
 dtml-in Catalog(process_step=['start','mailed'])
 
 li dtml-subject_name; -- dtml-relationship_name; - dtml-rater_name;
 
 /dtml-in
 /ul
 
 But, I only get one subject_name's worth of results with this:
 
 ul
 dtml-in Catalog(process_step=['start','mailed'], 
 sort_on='subject_name')
 
 li dtml-subject_name; -- dtml-relationship_name; - dtml-rater_name;
 
 /dtml-in
 /ul
 
 
 This smells like a BTrees bug to me, but I'm not sure. I'm looking into 
 this closely now, but if anyone's seen this before, please speak up!



More data:


This gives partial results:

dtml-in Catalog(process_step=['start','mailed'],
sort_on='subject_name')

This gives full results:

dtml-in Catalog(process_step=['start','mailed'],
sort_on='subject_name')[:]

This gives full results:

dtml-in Catalog(process_step=['start','mailed'],
sort_on='subject_name') sort=subject_name



--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] ZCatalog problem: sort_on bug

2001-09-24 Thread Steve Alexander

Steve Alexander wrote:

 
 This gives partial results:
 
 dtml-in Catalog(process_step=['start','mailed'],
 sort_on='subject_name')


...because this returns a LazyCat instance, for which len() is broken.


 This gives full results:
 
 dtml-in Catalog(process_step=['start','mailed'],
 sort_on='subject_name')[:]


...because this is a list.


 This gives full results:
 
 dtml-in Catalog(process_step=['start','mailed'],
 sort_on='subject_name') sort=subject_name


...because this is a LazyMap instance, for which len() works.


Patch coming up soon...



-- 
Steve Alexander
Software Engineer
Cat-Box limited




___
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] ZCatalog problem: PATCH

2001-09-24 Thread Steve Alexander

Steve Alexander wrote:

  
  
   Patch coming up soon...


Patch against Catalog.py, from CVS:

*** lib/python/Products/ZCatalog/Catalog.py.original
--- lib/python/Products/ZCatalog/Catalog.py.patched
***
*** 673,679 
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=LazyCat(map(lambda i: i[1], r), len(r))

return r

--- 673,681 
if (type(so) is type('') and
lower(so) in ('reverse', 'descending')):
r.reverse()
! r=map(lambda i: i[1], r)
! r=LazyCat(r, reduce(lambda x,y: x+len(y), r, 0))
!

return r


I'd use a list comprehension instead of a map(lambda...) if I thought it
would get past Jim ;-)

--
Steve Alexander
Software Engineer
Cat-Box limited



___
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] ZCatalog bug

2001-09-18 Thread Steve Alexander

I'm updating a site that is currently using Python 1.5.2 and Zope 
2.3.something to use Python 2.1 and Zope 2.4.from_cvs.

I've had a problem: most products won't initialize. They fail on an 
AttributeError in SearchIndex/UnTextIndex.py related to setting up the 
help system.

This ugly patch fixes it. There must be a better way!



*** /lib/python/SearchIndex/UnTextIndex.py.original
--- /lib/python/SearchIndex/UnTextIndex.py.new
***
*** 327,333 
   return 0

   lexicon = self.getLexicon(self._lexicon)
! splitter=lexicon.Splitter

   wordScores = OIBTree()
   last = None
--- 327,337 
   return 0

   lexicon = self.getLexicon(self._lexicon)
!
! try:
! splitter=lexicon.Splitter
! except AttributeError:
! splitter=lexicon.lexicon.Splitter

   wordScores = OIBTree()
   last = None
***
*** 343,349 

   # Convert scores to use wids:
   widScores=IIBucket()
! getWid=lexicon.getWordId
   for word, score in wordScores.items():
   widScores[getWid(word)]=score

--- 347,356 

   # Convert scores to use wids:
   widScores=IIBucket()
! try:
! getWid=lexicon.getWordId
! except AttributeError:
! getWid=lexicon.lexicon.getWordId
   for word, score in wordScores.items():
   widScores[getWid(word)]=score

--
Steve Alexander
Software Engineer
Cat-Box limited


___
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] Unauthorized error with this code

2001-09-17 Thread Steve Alexander

Servizio tecnico NOMOS wrote:


 
 *This work and diplay correctly: test test.*
 
 ** 
 
 *This problem there is only ZOPE 2.4.0, the precedent version is run OK.*
 
 ** 
 
 *Can you help ME ?*


You should read up on the Zope security model. You'll need to make 
security declarations in that class, or define the class attribute

   __allow_access_to_unprotected_subobjects__=1


You can read about the Zope security model in the Zope Developers' Guide:

   http://www.zope.org/Documentation/ZDG


Please do not post HTML mail to this mailing list. Your emails will most 
likely be ignored if you do so.

--
Steve Alexander
Software Engineer
Cat-Box limited


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



  1   2   3   4   5   >