Re: [Zope-dev] using WSGIPublisher

2012-10-30 Thread Ross Patterson
Martin Aspeli optilude+li...@gmail.com writes:

 On 7 June 2012 07:20, Michael Howitz m...@gocept.com wrote:
 Am 06.06.2012 um 19:58 schrieb Hanno Schlichting:
 […]
 As I said above, my main concern is keeping publisher events and
 exception views intact. Some of these events need to happen in code
 that's currently inside repoze.* middleware. Like before transaction
 commit, publication failure or publication success.
 […]

 +1 to re-add these events. In our WSGI projects it hurts that they are gone 
 now.

 There was a thread on this a while ago, and I did some in-depth
 research on the current state of WSGI publishers.

 See http://old.nabble.com/Zope-2-WSGI-investigation-to33063118.html#a33063118.
 Summary: use infrae.wsgi for now.

FYI, while working on the Plone WebPI installer, I tried both
infrae.wsgi and the Zope2 WSGI publisher.  I couldn't get infrae.wsgi to
work for a few different reasons:

  
https://github.com/plone/Installers-UnifiedInstaller/commit/be495bb5e0a71137cfe2169d6b72f7496059beac

  Fix problem with hanging requests and orphaned python processes.

  Opening ZMI or the `@@plone-addsite` view worked fine, but a vanilla
  Plone site would cause the browser to start getting a response but it
  never finished and the Python FCGI process would be orphaned from IIS.

  Switching back to the Zope2 WSGI server I found that Diazo themeing
  seems to work just fine anyways so I don't think we need it.

So the Zope2 WSGI publisher works for plone.app.themeing when I was told
that it wouldn't work without events.  *Shrug*

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] We need to change how code ownership works.

2012-08-20 Thread Ross Patterson
Wolfgang Schnerring w...@gocept.com writes:

 * Lennart Regebro rege...@gmail.com [2012-08-19 13:01]:
 On Sun, Aug 19, 2012 at 10:30 AM, Jens Vagelpohl j...@dataflake.org wrote:
 As far as I understand it, the legal lynchpin is that using Github
 (strongly) encourages merging code contributions of people that did not
 sign a contributor agreement -- which is the same situation as if
 someone attaches a patch file to a bug tracker ticket, but will be much
 more frequent and likely to happen.

 Could we, then, adopt a policy that we only merge pull requests (or
 whathaveyou) from people that have signed a contributor agreement?
 a) Tres, Jens: Would that work from a legal perspective?
 b) Ross, Alex: Would that still yield the advantages of the distributed
 source control model?

+10

Absolutely, seems like the best way to do this is to use the existing
zopefoundation github org and ensure that we only add members with
merge/push permission that have signed the agreement.

https://github.com/zopefoundation

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] We need to change how code ownership works.

2012-08-20 Thread Ross Patterson
Charlie Clark charlie.cl...@clark-consulting.eu writes:

 Am 20.08.2012, 12:27 Uhr, schrieb Robert Niederreiter r...@squarewave.at:

  https://github.com/popular/starred
  i doubt that github i willing to get into the doghouse by doing
 really nasty things - and thus getting into risk of loosing
 projects.

 This is pure speculation, or are you privy to board decisions at Github.

It is also speculation that the ZF won't become in some form or another
a liability to, rather than an asset to, Zope development and community
participation.  It's also speculation that ZF efforts and the efforts of
its volunteers will do better at maintaining security or stability of
services.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] [Checkins] SVN: zc.buildout/ Moved to github

2012-08-19 Thread Ross Patterson
Robert Niederreiter r...@squarewave.at writes:

 On 19.08.2012 10:30, Jens Vagelpohl wrote:

 On Aug 19, 2012, at 10:17 , Lennart Regebro rege...@gmail.com wrote:

 And since it becomes ever easier to accept code from unknown
 sources (e.g. pull requests) legal code ownership becomes an issue
 again.

 And that returns me to my first question: Is it really legally
 different for a contributor to accept a pull request from a
 non-contributor compared with a contributor merging a patch from a
 non-contributor?

 Legally, both are disallowed unless there's some proof (written
 statement etc) from the code author that he assigns ownership of the
 patch or the contents of that pull request to the contributor who is
 doing the checkin.

 In the past we haven't done a good job of enforcing this clear
 ownership assignment chain. There are always code patches from
 non-contributors in the bug tracker that may make it into the code
 base with the help of a contributor. There's a grey area: Is the act
 of submitting a patch into the Zope bug tracker enough to signal I
 am giving you ownership of this code? I am not sure.

 GitHub makes this pulling in of outside code even easier. I'm
 afraid it will become even harder to really maintain this chain of
 custody.

 I just wonder why this works then for other projects like plone or
 pyramid which basically follows similar rules as the ZF with a signed
 contributor agreement required in order to make core contributions.

 http://plone.org/foundation/contributors-agreement/agreement.pdf/view

 https://github.com/Pylons/pyramid/blob/master/CONTRIBUTORS.txt

 btw - pyramid seem to have a very pragmatic approach for the signing
 process ;)

 Either way - SVN or GIT - it is just a question IF merging code from a
 non-contributor is done BY a contributor, not HOW.

 For me the discussion sounds a little like a general denial against
 github using the legal story as rationale.

+10.  I'm so glad others are saying the things I think need saying.

I *am* a signed ZF contributor and from experience, the likelihood of
such stop energy or other unpleasantness prevents me from contributing
to Zope projects nearly as much as I'd like or could.  This is a
sterling example.

To be clear, I'm not invalidating legal concerns, I'm only frustrated
that those representing those concerns are taking a hard line on only
one concern without seeming to accept multiple invitations to work the
problem from all represented concerns.  I'm grateful to the others for
trying so hard to kickstart a healthy level of participation in
zc.buildout development once again.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Adding broken/missing support to zope.interface?

2012-04-11 Thread Ross Patterson
Hanno Schlichting ha...@hannosch.eu writes:

 On Mon, Apr 9, 2012 at 10:33 PM, Tres Seaver tsea...@palladion.com wrote:
 Persistent component registries are not a good enough reason to add such
 coupling (I'd be in favor of splitting support for persistent registries
 out of zope.component, too, while we're at it).

 Let's put the broken support into code which depends on
 zope.interface, zope.component, and the ZODB, and invert the dependency
 by having the new code install something into the base code which
 provides the desired support:  the only change to zope.interface should
 be documenting the insertion point, and testing that it does the right
 thing when a dummy is plugged into it.

 I looked at the possible contenders for that dependency description.
 The ZODB depends on zope.interface itself, though not on
 zope.component.

 zope.container is the one that has the most minimal dependencies,
 while still relying on zope.component and the ZODB.

 zope.site depends on zope.container, but given its scope sounds like
 the better place to me. I vaguely remember us discussing to move
 persistent registries into zope.site at some point. Since we moved
 zope.site.hooks into zope.component, zope.site doesn't have much else
 to do anymore.

 Apart from those two, there's a whole lot more that have far more
 dependencies or are unrelated in scope, like zope.annotation or
 zope.catalog.

This problem isn't so much ZODB specific as it is specific to pickling.
The problem I don't know how to solve without modifying zope.interface
is that the on pickle end of things, the only hook I'm aware of is on
the unpickling side, namely overriding `find_global` as ZODB does.
But there's no way for `find_global` to know that the given global
should be an interface just from the module and name which is what
the pickle contains.  We need to hook into the process at the time the
object is pickled.  As far as I can see the only way to do that is
through the object's __reduce__ method.

As such, the only options I see are to add something conditional to
`zope.interface.InterfaceClass.__reduce__` or to make
`zope.interface.InterfaceClass.__reduce__` hookable in some way.  Would
the latter address the concerns people are raising here?  If so, what's
the right way to approach implement that?  Just monkey patching from
ZODB to zope.interface?

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Adding broken/missing support to zope.interface? (was: experimental.broken - Graceful handling of broken interfaces and components in the ZODB)

2012-04-08 Thread Ross Patterson
experimental.broken is working well for me.  It greatly aided me in
getting through a particularly nasty upgrade allowing me to cleanup the
ZCA cruft left by poorly behaved add-ons.  I'd like to proceed with
adding the core of this to zope.interface and I need the
developers/maintainers to weigh in.

The first and most fundamental matter is changing interface pickles such
that they can be unpickled into something that can fulfill the minimum
interface contract and don't break the ZCA.  To that end, I'd like to
add the following to zope.interface.interface:

...
try:
from ZODB.broken import find_global
from ZODB.broken import IBroken
def find_interface(modulename, globalname,
   Broken=IBroken, type=InterfaceClass):

Find a global interface, returning a broken interface if it can't 
be found.

return find_global(modulename, globalname,
   Broken=IBroken, type=InterfaceClass)
except ImportError:
IBroken = Interface
def find_interface(modulename, globalname,
   Broken=IBroken, type=InterfaceClass):

Find a global interface, raising ImportError if it can't be found.

# From pickle.Unpickler.find_class
__import__(module)
mod = sys.modules[module]
klass = getattr(mod, name)
return klass
...
class InterfaceClass(Element, InterfaceBase, Specification):
...
def __reduce__(self):
if self is IBroken:
return self.__name__
return (find_interface, (modulename, globalname))
...

With this change, previously existing interface pickles will be
different from newly committed ones but both pickles would unpickle to
the same object.  Also, running zodbupdate would convert all pickles to
the new format.

Is this the correct approach?  If not, how should it be changed or what
might be the correct way?  Is there a better way to put the broken
object support in ZODB and still have the same interface pickles when
using ZODB?

This still leaves the problem of instance provides declarations and
component registrations which contain previously existing interface
pickles for missing interfaces.  Without addressing these, previously
existing instance pickles cannot be unpickled and all component registry
operations fail.  experimental.broken addresses these by adding handling
for broken interfaces when provides declaration are unpickled (in the
ProvidesClass.__init__ method) and when component registries are
unpickled (in the __setstate__ method of
persistentregistry.PersistentAdapterRegistry and
persistentregistry.PersistentComponents).  Again, with these patches,
missing interfaces don't break instances or registries and allow running
zodbupdate to fix all existing pickles.  Where should this support live?
Should I keep it in a separate package, maybe just rename
experimental.broken to z3c.broken or somesuch?  Should it be merged into
zope.interface and zope.component?

Will the developers/maintainers of zope.interface, zope.component and/or
ZODB please weigh in on this and give me feedback towards getting this
finished?

Thanks!
Ross

Ross Patterson m...@rpatterson.net writes:

 I've done some more work on this and I've gotten the component
 registrations fully working now with one exception that I'm having real
 trouble with.  I'd like some help with that, more below.  I'm also a bit
 more clear on what might be appropriate to bring back into
 zope.interface and I'd like feedback on that.

 Currently interfaces are pickled as globals.  Given their centrality in
 any ZCA application, I think they should be pickled using a function:

 def __reduce__(self):
 return (find_interface, (modulename, globalname))

 where find_interface, if ZODB.broken.find_global can be imported, in
 turn calls:

 ZODB.broken.find_global(modulename, globalname,
 Broken=IBroken, type=InterfaceClass)

 since find_global already has nicely abstracted graceful missing global
 handling.

 If this were added to zope.interface, and changed ZODB objects with
 marker interfaces or persistent registries where all the code for the
 interfaces is still available will then be updated with pickles that
 will gracefully handle missing interfaces in the future.  Thus you could
 use zodbupdate to make sure that the interfaces in your ZODB will fail
 gracefully in the future.  Do you agree/disagree that this belongs in
 zope.interface?

 What this will not address are existing interfaces-as-globals pickles
 where the original interface is now missing.  That's where the other
 patches in experimental.broken come in, they intercept the two contexts
 where we can infer that a missing global should be an interface:
 instance provides declarations and persistent component registries.  By
 hooking

Re: [Zope-dev] [Plone-developers] experimental.broken - Graceful handling of broken interfaces and components in the ZODB

2012-04-08 Thread Ross Patterson
Raphael Ritz r.r...@biologie.hu-berlin.de writes:

 On 11/7/11 10:36 AM, Malthe Borch wrote:
 On 7 November 2011 09:17, Ross Pattersonm...@rpatterson.net  wrote:
 The intention of this package is to see if the implementation of broken
 object handling is correct and robust enough to merge into
 zope.interface and zope.component themselves.  Is this the right
 approach?  If not why and what would be better?  How might this approach
 be improved?

 (removed plone-dev from cc).

 Isn't it symptom treatment though?

 Yes, it is but the symptom is severe and not uncommon.
 The problem Ross is addressing here just happens way too often
 in the real world to simply say Sorry, user error.

Exactly.  There is also precedent.  The same argument Malthe offers
would suggest we shouldn't have ZODB.broken, but we do.  We have it
because the ZODB is too fundamental a piece of such applications to let
it break so completely when code is missing.  The same is true of the
ZCA, it's too fundamental a piece of such applications to let it break
completely when code is missing.

Ross

 If you've got an add-on which adds
 marker interfaces to general objects, shouldn't that add-on remove –
 or no longer provide – those same interfaces when it's uninstalled? At
 least in Plone, you can easily query content objects providing a
 particular set of interfaces.

 I think it's a non-goal to be able to run a system without all the
 required software – which is how I understand it when you just do a
 hard remove of an add-on without a prior soft remove.

 \malthe
 ___
 Zope-Dev maillist  -  Zope-Dev@zope.org
 https://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
   https://mail.zope.org/mailman/listinfo/zope-announce
   https://mail.zope.org/mailman/listinfo/zope )


 ___
 Zope-Dev maillist  -  Zope-Dev@zope.org
 https://mail.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists - 
  https://mail.zope.org/mailman/listinfo/zope-announce
  https://mail.zope.org/mailman/listinfo/zope )

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] beta.zope.org (www.zope.org relaunch project)

2011-05-10 Thread Ross J. Reedstrom
On Tue, May 10, 2011 at 06:55:43AM +0200, Andreas Jung wrote:
 
 Constructive criticism and feedback is welcome _now_.
 

What's your target client browser versions? It renders fine in Chrome
8.0 and firefox 3.6.17 (on linux), but 3.0.6 renders the
portal-siteactions at the top of the blue bar, rather than at the top of
the page. Admittedly an relatively ancient browser, but thought you
might like to know.

Ross
-- 
Ross Reedstrom, Ph.D. reeds...@rice.edu
Systems Engineer  Admin, Research Scientistphone: 713-348-6166
Connexions  http://cnx.orgfax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E  F888 D3AE 810E 88F0 BEDE
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Context priority as an alternative to configuration directive overrides

2010-12-04 Thread Ross Patterson
Malthe Borch mbo...@gmail.com writes:

 I always found configuration overrides (e.g. ZCML's includeOverrides
 directive) to be difficult to manage and hard to get right.

 How about an alternative where you can put a priority on a
 configuration context like so:

   adapter zcml:priority=100 ... /

 Default priority would be 0, traditional overrides get the maximum
 priority. ZTK components might then all be at the default priority,
 making it trivial to add a preferred component in a custom setup.

 If accompagnied by a sane amount of logging output, this system might
 facilitate plugging in components for the rest of us.

I'd like to echo Malthe's concern here.  I've had many issues with this
as well.

Recently I had a conversation with someone or read something about using
add-on specific stacked component registries.  Would this be the best
way to solve these kind of problems?  Unfortunately I can't remember
where I head/read of this.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope 3 porting sprint?

2010-11-25 Thread Ross Patterson
Lennart Regebro rege...@gmail.com writes:

 OK, I've run out of steam for this run of trying to port zc.buildout
 to Python 3. I got pretty far, in fact. Of course, if we wait too
 long, somebody will make big changes, and all will be messy and the
 branch will rot and we might as well start over. :-) So I want to
 avoid that, and get some help on zope.proxy and zc.buildout to finish
 the ports.

 The best way to do this is a sprint. And there are loads of small
 tasks to do as well, such as test zope.hookable and zope.i18nmessage
 on Plone and ZTK to make sure nothing breaks (even though each modules
 tests pass), merge and release it. Also finish the Python 3 port of
 zope.testing/zope.testrunner. All these are small and fairly easy
 tasks that I'm sure somebody else interested could do.

 I hope to attend PyCon, so that would be an option. Otherwise we have
 to do an online sprint, which with irc and skype/google phone should
 be doable. I'd havetime for that in January, I think.

 Of course, if people want to come to Krakow for a sprint I would be
 happy host it. But you'd have to pay for plane tickets yourself. And
 hotels, unless you want to sleep on my floor. :-)

 Who would be interested in a sprint, when, where and how?

I'd be interested in remote sprinting.  I'm available now, FWIW.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Minutes from this weeks meeting

2010-04-16 Thread Ross J. Reedstrom
On Thu, Apr 15, 2010 at 11:31:32PM +0200, Christian Theune wrote:
 On 04/15/2010 11:27 PM, Wichert Akkerman wrote:
  On 2010-4-15 17:59, Christian Theune wrote:
  Hi,
 
  here's the minutes. As I've been adventurous, I'll add a few comments:
 
  * I've started diving into the matter of how to manage items that we
  park/defer/postpone/wait for and thus started using an online system.
  (The only one I was able to find anyway.)
 
  * The output is a PDF which is currently a bit messy as I wanted to get
  rid of my text files that had the open issues sitting in there and
  thus had to add all of them to our agenda on Tuesday and then defer
  them. I think next week will become less noisy.
 
  Will next week be text again?
 
 Probably not - the system currently only allows for PDF output, but I've 
 mailed them a question about getting plain text.

I've attached the output of pdftotext (from xpdf-utils on a debian
system) Seems pretty clean to me. Long lines aren't wrapped (a quick
pass through fmt seems to do little damage, though: attached as well).

I'm a great fan of the IRC meetings and the notes, by the way: any tool
that helps you get these done is a good thing.  However, text is so much
more flexible for these reports to the list: the followup quoting issue
alone is a big one.

Ross
-- 
Ross Reedstrom, Ph.D. reeds...@rice.edu
Systems Engineer  Admin, Research Scientistphone: 713-348-6166
The Connexions Project  http://cnx.orgfax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E  F888 D3AE 810E 88F0 BEDE
Zope Developers
Meeting date: Location: Purpose/Notes: Chaired by: Minutes rec. by: Tuesday, 
April 13, 2010 from 3:00 PM to 3:30 PM irc://#zope Regular scheduled meeting 
Christian Theune Christian Theune

Attendance:
Present: Christian Theune Regrets: Absent: Late:

Guests:
(none)

Meeting Documents:
(no documents)

Meeting Minutes: 1. Committee business
Christian Theune Discussion about the KGS 3.4.1 was included into the agenda by 
request of Adam Groszer.

1.1. Review Agenda

Launchpad bug management issues were included into the agenda by request of 
Tres Seaver. Item Status: Completed

2. Old business
2.1. Upcoming bug day
Announcements have been send out to zope-dev, although there hasn't been much 
feedback. Tres reported having had a mini-bugdy by himself in between and that 
he has been experimenting with using bzr (and other DVCS') against the SVN 
server to allow others more easily to contribute without having to directly 
sign an agreement. Some documentation about this is available here: 
http://svn.repoze.org/docs/repoze/HACKING.rst Adam reported he'd be available 
for mentoring the bug day as did Christian Theune. Tres' will be around for at 
least part of the day. Otherwise we'll wait for the bug day to come. Item 
Status: Completed

2.2. Resurrecting sprint schedule page
Adam Groszer wondered whether we can have something that makes upcoming sprints 
more visible to developers. We decided to merge this topic into the next item 
(General calendar). Item Status: Completed

2.3. Calendar for Zope-related events
We'd like to see a general calendar that includes all kinds of Zope-related 
events (Sprints, Conferences, ...). As Jan Smith (VP Zope Foundation) is 
already working on a proposal for a general calendar we decided to
Page 1 of 3 Printed: 4/15/2010

wait for her until after the next ZF board meeting. Item Status: Deferred: 
4/30/2010

2.4. Test runners/nightly builds
We haven't had input on this topic itself. (Personally having a how are we 
doing? status check every now and then would be nice). Item Status: Parked

2.4.1. List of projects/platforms/... for guaranteed builds
We need to define the combinations of projects/platforms/Python versions etc. 
that we want to give a guarantee that our builds work. Adam Groszer recommended 
including Windows 64 into the list of platforms. Item Status: Parked

2.5. Restructuring the LP packages/bug trackers
Tres' asked to stop using a single central bug tracker but split of bug 
tracking so that each ZTK package has its own bug tracker on LP. One of the 
problems of the current situation is that we get bug reports at inappropriate 
places. We already discussed this before but were uncomfortable with doing this 
right away and intended to temporarily use a central bug tracker for ZTK and 
then splitting of. Also, there was previous work by Christian Theune from last 
EuroPython where he started to create projects but got caught up in details and 
didn't finish. Tres' proposed to assist with the transition and Christian 
Theune offered to help as well. They intend to do the cleanup and start 
triaging before the upcoming bug day. In case of hitting stumbling blocks we'll 
ask Sidnei and Gary for help as they're part of the LP team. Item Status: 
Deferred: 4/27/2010

2.6. Release KGS 3.4.1
Adam Groszer is trying to get a 3.4.1

Re: [Zope-dev] Zope3 sessions and database conflicts

2010-03-04 Thread Ross Patterson
Hermann Himmelbauer du...@qwer.tk writes:

 Hi,
 For quite some time I see messages like this in my z3.log:

 2010-03-02T16:27:14 WARNING ZopePublication Competing writes/reads 
 at /BSPSite/act/++vh++http:zis.act.at:80/bankneu/++/images/sponsor_logo.png: 
 database conflict error (oid 0x063f, class BTrees.OOBTree.OOBucket, serial 
 this txn started with 0x038484dc7d5ac044 2010-03-02 14:52:29.379960, serial 
 currently committed 0x038484ff3c6b5455 2010-03-02 15:27:14.160763)

I note the conflict happened when the request was just for an image.
I've seen this before under Zope2 when a PAS plugin was mis-using the
session machinery as a cache during authentication of the request.  When
ever a session object is accessed it initiates a write transaction in
the ZODB.  With most, if not all, authentication methods, when a user is
logged-in the auth tokens are included in every request which means
every request from the logged-in user invokes the authentication
machinery, including requests for images.  Since every page load
involves multiple requests for page resources, the database gets
overwhelmed with write transactions which inevitably conflict.  When the
write conflict occurs, the publisher appropriately retries the request
which multiplies the number of requests which multiplies the load which
increases the amount of time taken in processing requests which
multiplies the likelihood of write conflicts and your off to the races
in the wrong direction.

So I'd suggest you find out what in a request for a simple resource
(images, non-dynamic CSS or JS) is initiating the write transaction by
invoking sessions.  It's likely there's an inappropriate use of sessions
there.

HTH,
Ross

 I followed an advice from the zope-dev list and added some debug messages in  
 ZODB.Connection.py where the objects are registered for writing. 

 The following debug messages (I print the key/values of the object in 
 question) occur before and after the database conflict error:

 ---
 2010-03-02T16:27:14 DEBUG zbsp keys: 
 ['6ZZzgjNK0p.bIIlruXb4JkDo-T0J-XipPcVFGtcj0
 LH6dMdI9akYvg', . , '7MmOPQOlkAHoa3T
 nydH9IIgKBqoVyn3Q.yH6OXJeLj7epObIy3M5Lg']
 ---
 2010-03-02T16:27:14 DEBUG zbsp values: [zope.session.session.SessionData 
 object at 0x43723bec, zope.session.session.SessionData object at 
 0x4372356c, zope.session.session.SessionData object at 0x437233ec, 
 .
 zope.session.session.SessionData object at 0x436b586c, 
 zope.session.session.SessionData object at 0x436b532c, 
 zope.session.session.SessionData object at 
 0x43640b6c,zope.session.session.SessionData object at 0x436b572c]
 ---

 So it seems these are the session data containers.

 I wonder why they are written? Perhaps this happens when somebody else is 
 logging into the system (so a new session is added) and others are 
 concurrently reading from the session? However, this would mean that the 
 session mechanism has a flaw, as this is a standard procedure?

 Any ideas of how to fix this?

 Best Regards,
 Hermann

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Adding W3C validating to zope.testbrowser

2010-02-28 Thread Ross Patterson
Brian Sutherland br...@vanguardistas.net writes:

 On Tue, Feb 23, 2010 at 04:57:02PM +0200, Marius Gedminas wrote:
 On Tue, Feb 23, 2010 at 08:57:09AM -0500, Benji York wrote:
  On Sat, Feb 20, 2010 at 7:53 AM, Ross Patterson m...@rpatterson.net 
  wrote:
   I started a branch for doing W3C HTML validation on responses to
   zope.testbrowser requests:
  

   svn://svn.zope.org/repos/main/zope.testbrowser/branches/rossp-validator
  
   The idea is to be able to flip a switch and run all my functional
   zope.testbrowser tests and see validation failures as test failures.
  
  I'm not keen on this idea.  Validation checking isn't hard to do with
  testbrowser as-is, and doing it on every page load is overkill.  Add to
  that the global nature of the required switch and this really doesn't
  seem like the right approach.
 
 I'd like to chime in and suggest using WSGI to hook up zope.testbrowser
 and zope.app.testing.functional (or a better-designed replacement for
 the latter).  Then you could plug in W3CValidatingMiddleware (if one
 doesn't exist, it should be trivial to write it) between them.

 We use wsgi_intercept to get zope.testbrowser to listen to the other end
 of a WSGI pipe during testing

 http://pypi.python.org/pypi/wsgi_intercept

Yeah, I've looked at wsgi_intercept before.  Good stuff.

 The testbrowser integration we have is far from perfect but was enough
 for is to stop using zope.app.testing.functional

 
 http://svn.zope.org/van.testing/trunk/van/testing/layer.py?rev=105324view=markup

Thanks, I'll check it out.

 It would be pretty simple to have a make_application call that wrapped
 the application in validating middleware depending on an environment
 variable.

Yeah, the more I've thought about it, the more I've been thinking the
right place to do this is in the application's publisher somehow, such
as in a WSGI pipeline.  This would make the validation more widely
usable, specifically to non-developers.  It would me more of a kind of
debug mode.

Lo and behold, it's been done:

http://workaround.org/node/266

Appending the validation errors to the end of the page won't work for
using existing functional tests as a validation testbed because no error is
raised on validation failures and many functional tests ignore the
parts of the returned page they're not interested in.  As such, the
tests won't fail on validation errors.  I can't imagine it would be too
hard to change this behavior.

I'll have to try adding WSGI to one of my typical Zope 2.10, Plone 3
add-on testing buildouts to see how much of a burden this places.

More later,
Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Adding W3C validating to zope.testbrowser

2010-02-21 Thread Ross Patterson
Ross Patterson m...@rpatterson.net writes:

 I started a branch for doing W3C HTML validation on responses to
 zope.testbrowser requests:

 svn://svn.zope.org/repos/main/zope.testbrowser/branches/rossp-validator

 The idea is to be able to flip a switch and run all my functional
 zope.testbrowser tests and see validation failures as test failures.
 The current implementation in that branch just uses a simple environment
 variable since I wasn't sure what the best way was to support flipping a
 switch like that.  Note that it's possible to use a local installation
 of the W3C validator (such as is available on Debian based systems in
 the w3c-markup-validator package) so that the validation doesn't
 actually slow tests down all that much.

 I have a couple of questions I'd like to hear any thoughts on.

 What's the best way to support flipping the switch in a global sense
 so that during the inner testing loop extra time isn't being wasted on
 repeated validations?

 Does this belong in zope.testbrowser or in the underlying mechanize
 package?

Another option would be to integrate this with the publisher itself.
For example, an option could be provided for validating the HTML to be
returned by the publisher whenever it's running in validating mode,
similar to debug mode.  It seems like this could make the validating
service more accessible to less technical users.  I'm not really sure
where this belongs.

Ross

 Other than that, what's the path forward to merging?

 Ross

 ___
 Zope-Dev maillist  -  Zope-Dev@zope.org
 https://mail.zope.org/mailman/listinfo/zope-dev**  No cross posts or HTML 
 encoding!  **
 (Related lists - 
  https://mail.zope.org/mailman/listinfo/zope-announce
  https://mail.zope.org/mailman/listinfo/zope )

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] Adding W3C validating to zope.testbrowser

2010-02-20 Thread Ross Patterson
I started a branch for doing W3C HTML validation on responses to
zope.testbrowser requests:

svn://svn.zope.org/repos/main/zope.testbrowser/branches/rossp-validator

The idea is to be able to flip a switch and run all my functional
zope.testbrowser tests and see validation failures as test failures.
The current implementation in that branch just uses a simple environment
variable since I wasn't sure what the best way was to support flipping a
switch like that.  Note that it's possible to use a local installation
of the W3C validator (such as is available on Debian based systems in
the w3c-markup-validator package) so that the validation doesn't
actually slow tests down all that much.

I have a couple of questions I'd like to hear any thoughts on.

What's the best way to support flipping the switch in a global sense
so that during the inner testing loop extra time isn't being wasted on
repeated validations?

Does this belong in zope.testbrowser or in the underlying mechanize
package?

Other than that, what's the path forward to merging?

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] zope.testing.testrunner.debug.post_mortem and try/finally

2009-12-02 Thread Ross Patterson
When a try/finally clause is (appropriately) used to do cleanup after an
exception during a test run, it often tears down parts of the fixture
that are needed in order to do useful post_mortem debugging of the
exception, such as closing the request or db connections.  What is the
best way to do post_mortem debugging with the stack in the state it was
at the time of the exception?

For a while now, I've been repeatedly modifying eggs in my development
environment at the relevant try/finally clauses to invoke post_mortem
before the tear down is done, sub-optimal to say the least.  :)  I find
myself doing it often its time to invest in a better way.

Is there some Python voodoo I'm unaware of to get a post_mortem to
reflect the stack before try/finally clauses?  If not, is putting
some sort of hook into the relevant try/finally clauses the best way to
address this?  If not, what should I be doing?

If putting hooks into the try/finally clauses is the right way, then it
would be nice to have a somewhat canonical way to do this.  It would
also be nice to have a way to pass something down the line so that
post_mortem() only gets called once per exception.

Thoughts,
Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.testing.testrunner.debug.post_mortem and try/finally

2009-12-02 Thread Ross Patterson
Tres Seaver tsea...@palladion.com writes:

 Ross Patterson wrote:
 When a try/finally clause is (appropriately) used to do cleanup after an
 exception during a test run, it often tears down parts of the fixture
 that are needed in order to do useful post_mortem debugging of the
 exception, such as closing the request or db connections.  What is the
 best way to do post_mortem debugging with the stack in the state it was

 at the time of the exception?
 
 For a while now, I've been repeatedly modifying eggs in my development
 environment at the relevant try/finally clauses to invoke post_mortem
 before the tear down is done, sub-optimal to say the least.  :)  I find
 myself doing it often its time to invest in a better way.
 
 Is there some Python voodoo I'm unaware of to get a post_mortem to
 reflect the stack before try/finally clauses?  If not, is putting
 some sort of hook into the relevant try/finally clauses the best way to
 address this?  If not, what should I be doing?
 
 If putting hooks into the try/finally clauses is the right way, then it
 would be nice to have a somewhat canonical way to do this.  It would
 also be nice to have a way to pass something down the line so that
 post_mortem() only gets called once per exception.

 Are you using try:...finally:... inside your testcase methods?  If so,
 why not just move the cleanup invocation into your 'tearDown' for the
 testcase class:  at that point, the '-D' option to the testrunner will
 stop you at the error, with the tearDown not yet called.

I'm sorry, I was unclear, the try/finally clauses are not necessarily in
*test tearDown* methods (though I used that language), they are often a
part of the application being tested, such as closing the request,
closing DB connections, or aborting transactions.

 Or are you doing this in doctests?  If so, move the code you are testing
 into a real testing framework. ;)

Oh, goody.  Derogatory evangelism.  :)  Doctests have tearDown just like
other tests.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.testing.testrunner.debug.post_mortem and try/finally

2009-12-02 Thread Ross Patterson
Benji York be...@zope.com writes:

 On Wed, Dec 2, 2009 at 1:22 PM, Ross Patterson m...@rpatterson.net wrote:
 I'm sorry, I was unclear, the try/finally clauses are not necessarily in
 *test tearDown* methods (though I used that language), they are often a
 part of the application being tested, such as closing the request,
 closing DB connections, or aborting transactions.

 In those situations I just edit the code and put a import
 pdb;pdb.set_trace() at the top of the finally: block and re-run the
 test.

 It is an interesting idea to provide some way to make that automatic.
 Maybe a settrace hook that will invoke pdb at the top of every finally
 clause that is encountered, somewhat similar to the -D option.  You
 might end up getting way too many false positives though.

 Here's another idea: a testrunner option that takes a file name and line
 number and inserts a breakpoint at that position.  That way you can get
 the same effect as editing the code without actually having to do so.

Or maybe a combination of the two where a configuration file is read for
file and line numbers at which to do a post_mortem using a settrace hook
where if the first one of those is hit no further post_mortem's are
executed?

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] improving the utility and adapter lookup APIs

2009-11-25 Thread Ross Patterson
Marius Gedminas mar...@gedmin.as writes:

 On Wed, Nov 25, 2009 at 01:29:25PM -0500, Tres Seaver wrote:
 Matthew Wilkes wrote:
  On 2009-11-25, at 1601, Benji York wrote:
  
  I'm not sure I like the following suggestion better than the above,
  but throwing it out there anyway:

 
  Multiadapter:
 
  IFoo((x,y))
  
  I know it's probably a spurious use case, but what if I want to adapt  
  a tuple?
 
 I would agree that its completely spurious:  I can't imagine wanting
 that.  I prefer the regularity in Benji's spelling over satisfying a
 non-existing usecase.

 I am, in fact, adapting tuples for what I consider to be a good reason
 (pretty-printing arbitrary objects) in zodbbrowser.

 http://bazaar.launchpad.net/~zodbbrowser-dev/zodbbrowser/trunk/annotate/head:/src/zodbbrowser/value.py

Similarly, I've often sub-classed built-in types when using the ZCA such
that isinstance(obj, tuple) is True.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Zope and Cygwin

2009-03-26 Thread Ross Patterson
Cesar Canassa cesar.cana...@gmail.com writes:

 I am trying to run Zope using cygwin and Windows XP. I started by downloading 
 the
 Python 2.4.6 sources and compiling it with:

 ./configure
 make  make install

 After that I downloaded the Zope-2.11.2-final sources and compiled it with:

 ./configure --with-python=/usr/local/bin/python
 make  make install

 The compilation went smoothly so I created a instance and started the server 
 with
 the runzope script. The script returned this error:

 $ ./runzope
 Traceback (most recent call last):
   File /opt/Zope-2.11/lib/python/Zope2/Startup/run.py, line 56, in ?
     run()
   File /opt/Zope-2.11/lib/python/Zope2/Startup/run.py, line 21, in run
     starter.prepare()
   File /opt/Zope-2.11/lib/python/Zope2/Startup/__init__.py, line 109, in 
 prepare
     self.startZope()
   File /opt/Zope-2.11/lib/python/Zope2/Startup/__init__.py, line 300, in
 startZope
     Zope2.startup()
   File /opt/Zope-2.11/lib/python/Zope2/__init__.py, line 47, in startup
     _startup()
   File /opt/Zope-2.11/lib/python/Zope2/App/startup.py, line 105, in startup
     Globals.VersionNameName)
   File /opt/Zope-2.11/lib/python/App/ZApplication.py, line 32, in __init__
     if not root.has_key(name):
   File /opt/Zope-2.11/lib/python/ZODB/Connection.py, line 811, in setstate
     self._setstate(obj)
   File /opt/Zope-2.11/lib/python/ZODB/Connection.py, line 870, in _setstate
     self._reader.setGhostState(obj, p)
   File /opt/Zope-2.11/lib/python/ZODB/serialize.py, line 604, in 
 setGhostState
     state = self.getState(pickle)
   File /opt/Zope-2.11/lib/python/ZODB/serialize.py, line 597, in getState
     return unpickler.load()
   File /opt/Zope-2.11/lib/python/ZODB/serialize.py, line 471, in
 _persistent_load
     return self.load_oid(reference)
   File /opt/Zope-2.11/lib/python/ZODB/serialize.py, line 537, in load_oid
     return self._conn.get(oid)
   File /opt/Zope-2.11/lib/python/ZODB/Connection.py, line 245, in get
     obj = self._reader.getGhost(p)
   File /opt/Zope-2.11/lib/python/ZODB/serialize.py, line 591, in getGhost
     return klass.__new__(klass, *args)
 TypeError: Acquirer.__new__(Application) is not safe, use
 Persistence.Persistent.__new__()

 Am I doing something wrong? Does anyone knows if it's possible to compile Zope
 with Cygwin?

Maybe the following can help:

http://rpatterson.net/software/products.cygwinpatch
http://dev.plone.org/collective/browser/cygwinpatch/trunk/__init__.py
http://mail.zope.org/pipermail/zope/2005-December/163636.html

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] zc.recipe.cmmi shared builds

2009-03-24 Thread Ross Patterson
Wolfgang Schnerring w...@gocept.com writes:

 I'd like to extend zc.recipe.cmmi to support shared build directories.

 Use case example: we use lxml in a lot of our projects, which
 currently means having to build libxml and libxslt over and over
 again, since the buildout needs to be standalone and thus can't depend
 on them being installed on the system. But while that's a necessity
 for deployment, it's really annoying for development.

 Plan of attack:
 Introduce an option shared (defaults to False). If that is set,
 a) calculate HASH as a hash of the recipe's current options (e. g.
 configure parameters, environment variables)
 b) perform the cmmi in ${buildout:download-cache}/cmmi/build/HASH,
 if that directory is not present yet. (Probably needs a little thought
 about how to differentiate between present and has a complete build
 and present but we errored out)

This would be great.  I'm always happy when a build recipe provides this
option so I think generalizing it is a good idea.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] zope.index

2008-12-02 Thread Ross Patterson
Benji York [EMAIL PROTECTED] writes:

 On Tue, Dec 2, 2008 at 6:48 AM, Dan Korostelev [EMAIL PROTECTED] wrote:
 2008/12/2 Marius Gedminas [EMAIL PROTECTED]:
 On Tue, Dec 02, 2008 at 02:04:39AM +0300, Dan Korostelev wrote:
 I just removed zope.testing from the zope.index dependency and
 replaced zope.testing.doctest imports with plain python doctest and it
 seems to work with python 2.4 and 2.5 here. Now, it only depends on
 ZODB3 and zope.interface, which is nice :) Is there any objections on
 this?

 Yes.

 Using 'import doctest' rather than 'from zope.testing import doctest'
 was a pretty reliable way to break test.py --coverage, at least on
 Python 2.4.

 Oh, thanks for the hint. I'll fix that now. :) There's no need to use
 try/except though, it's nicer just to create an extras_require for
 tests, I think.

 The status quo is to forgo creating extras unless there is a compelling
 reason to have one.  Creating a test extra just to remove a dependency
 on zope.testing -- which only depends on zope.interface -- is not
 compelling.

I'd be curious, for my own edification, to hear what would be compelling
reasons.  Thanks!

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] zope.app.keyreference adds IPersistent objects to connections inappropriately? (was: five.intid and DirectoryView)

2008-06-29 Thread Ross Patterson
In this discussion from another list, Tres suggested that the bug might
be in zope.app.keyreference so I'm copying this to the development list.

The gist here is that the IPersistent, IObjectAddded event handler will
force objects to have connections and makes assumptions about what
connection it should get that might not be valid.  Here's the thread:

http://thread.gmane.org/gmane.comp.web.zope.plone.product-developers/2309

Thoughts?

Ross

Ross Patterson [EMAIL PROTECTED] writes:

 Tres Seaver [EMAIL PROTECTED] writes:

 Martijn Pieters wrote:
 On Fri, Jun 27, 2008 at 6:53 PM, Ross Patterson [EMAIL PROTECTED] wrote:
 Martijn Pieters [EMAIL PROTECTED] writes:
 But the code never does that. When cloning a file-based FSObject, a
 new instance is created and that is added to the ZODB. Noone else
 should do this either.
 zope.app.keyreference does.  The persistence machinery doesn't add an
 object to a connection until commit.  As such, an IPersistent and
 IObjectAdded event handler, such as the one in zope.app.intid, that
 needs the object to have a connection needs to add the object to a
 connection.

 Sounds like a bug in zope.app.intid to me:  it shouldn't be forcing
 objects to have connections.

 Why is the IObjectAdded event fired at all? Perhaps that's the bug here.
 
 Shouldn't anything that implements IPersistent be able to be added to a
 connection?  Wouldn't that be considered part of providing the
 interface?  Where else is an object that provides IPersistent stored in
 global state?
 
 I assume it was easier at the time to use just one class. Perhaps this
 should be reconsidered now. However, just providing the IPersistence
 interface does not mean the object expects to be added to a connection
 arbitrarily.

 Exactly.  Nobody is supposed to add objects to a connection except their
 already-persisted containers.

 That sounds right to me especially given that an object's parent isn't
 necessarily where the object is persisted.  Shouldn't it be possible,
 for example, to have a container that looks up it's contained items from
 a utility that actually is stored in another ZODB.  Such a container's
 items would not share their parent's connection.

 FWIW, this happens in zope.app.keyreference.  The reason it needs the
 object to have a connection is so that it can get the object's _p_oid.
 If this is a bug, how can zope.app.keyreference get _p_oid for an object
 added in the current, as yet uncommitted transaction?

 Ross

 ___
 Zope-CMF maillist  -  [EMAIL PROTECTED]
 http://mail.zope.org/mailman/listinfo/zope-cmf

 See http://collector.zope.org/CMF for bug reports and feature requests

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: unregistering components?

2007-11-24 Thread Ross Patterson
Chris Withers [EMAIL PROTECTED] writes:

 Hi All,

 Does the component architecture support un-registering adapters and
 the like?

From zope.component.interfaces:

class IComponentRegistry(interface.Interface):
Register components

snip...
def unregisterUtility(component=None, provided=None, name=u''):
Unregister a utility
snip...
def unregisterAdapter(factory=None, required=None,
  provided=None, name=u''):
Register an adapter factory
snip...
def unregisterSubscriptionAdapter(factory=None, required=None,
  provides=None, name=u''):
Unregister a subscriber factory.
snip...
def unregisterHandler(handler=None, required=None, name=u''):
Unregister a handler.
snip...

That'll do it, I think.  :)

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: Zope 3 catalog

2007-11-02 Thread Ross Patterson
Roché Compaan [EMAIL PROTECTED] writes:

 Where can one find Zope 3 catalog? Or is it simply zope.index?

I think zope.app.catalog is what you're looking for.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: Zope 3 catalog

2007-11-02 Thread Ross Patterson
Roché Compaan [EMAIL PROTECTED] writes:

 On Fri, 2007-11-02 at 11:44 -0700, Ross Patterson wrote:
 Roché Compaan [EMAIL PROTECTED] writes:
 
  Where can one find Zope 3 catalog? Or is it simply zope.index?
 
 I think zope.app.catalog is what you're looking for.

 Thanks. I was looking at the Zope 3 version distributed with Zope 2.10
 which doesn't seem to have zope.app.catalog.

Ah, yeah.  I don't think all of Zope3-the-application is included with
Zope2, just the Zope3 libraries currently in use in Zope2/Five.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: zc.recipe.egg and 'install' instead of 'develop'?

2007-10-31 Thread Ross Patterson
Jim Fulton [EMAIL PROTECTED] writes:

 On Oct 31, 2007, at 4:58 PM, Sidnei da Silva wrote:

 On 10/31/07, Jim Fulton [EMAIL PROTECTED] wrote:

 On Oct 31, 2007, at 12:45 PM, Sidnei da Silva wrote:

 Is there a recipe that will 'install' a distutils package from
 source
 instead of doing 'develop'? Couldn't find it. :(

 custom

 Erm, can you be more specific? The only two options in zc.recipe.egg
 seem to be 'develop' and 'custom', none of which will run a 'setup.py
 install' from a checkout.

 What do ya mean. I said custom. Geez. ;)

 I thought when you said source, you meant a source release.

 I don't think zc.recipe.egg has an option to install an egg from a
 source tree.  I can't think of a recipe off hand that does that.

Jim pointed out how it may be an abuse of buildout, but my
z3c.recipe.egg recipe supports running arbitrary setup.py commands on
source distributions.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: zcml entry points

2007-10-17 Thread Ross Patterson
Martin Aspeli [EMAIL PROTECTED] writes:

 Fred Drake wrote:
 On 10/17/07, Martin Aspeli [EMAIL PROTECTED] wrote:
 The main win, IMHO, is to avoid the requirement for people to install
 slugs for third party products. Slugs suck - they are confusing to
 explain and people forget them all the time. Buildout makes it a bit
 easier, but it's still not a terribly good solution.

 Slugs are evil; agreed.  We never use them.  They were an accident of
 the instance tree inherited from older versions of Zope, and how
 that tree was re-interpreted for Zope 3.  They never worked well, and
 did no one any favors.

 Glad we all agree.

 For example, say you want to install oi.plum. You need to add the line
 'oi.plum' twice - once under 'eggs' and once under 'zcml' in your
 buildout.cfg. Forget the latter, and the package doesn't work properly
 (or at all).

 I actually really like this; I don't get the configuration for a
 package unless I ask for it.  It's not unusual to want only the code
 and not the default configuration for a package.

 Right - but you're building an application, and you're pretty
 experienced with Zope. A lot of Plone users just want to install a
 plug-in (a product), basically. Before, they just dropped it into a
 directory. Now, they declare it twice in a file (presuming there's a
 cheese shop release). That's a (small) step backwards
 (duplication). Declaring it once would be a step forwards (no manual
 download)

 If we had entry points, we could just load the egg. Internally, oi.plum
 may use include / as much as necessary to load *its* dependencies, but
 that's not something the user of the package needs to worry about.

 Requiring a package doesn't say anything about how it's going to be
 used; making an assumption about that is really bad.

 Maybe. I agree there should be an option not to do this, and many eggs
 may choose *not* to use an entry point. For things like Plone add-on
 products, though, it makes much more sense to have it be automatic. To
 generalise further - if what you're installing is a high level,
 cohesive product, with a UI and an install method and all the rest of
 it, having installation be as simple as possible is a big win. For the
 components further down the stack (e.g. the things that these high
 level products are depending on!), having the processing be explicit
 (via include / directives) makes more sense.

 If Zope loaded entry-point ZCML automatically (maybe with an on/off
 switch in zope.conf for those who need more fine grained control) that'd
 be a pretty nice solution.

 I suspect I'd always want it off.  Picking up configuration
 willy-nilly is too dangerous.

 Maybe it's off by default, then, but I *know* this would make the
 add-on products story in Plone easier: I've seen people struggle with
 slugs, editing site.zcml is far tto scary, and you don't always have a
 package that you own to include other things from.

 I suspect entry points would make life simpler for other systems that
 used a similar mechanism for plug-ins/add-ons. However, I agree that
 they're not appropriate for more fundamental libraries.

I'm new to eggs, but maybe both sides could be satisfied with an
approach like extra_requires?  You could list oi.plum [zope.zcml] when
you require oi.plum *and* its ZCML and then it's ZCML would get loaded.
Is this easily possible with eggs and/or buildout?  If not, maybe it's
a worthwhile extension.  I guess the abstracted idea would be some way
to pass configuration directives to eggs as a part of requiring them.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Getting PAS users to show up in the access log/Z2.log

2007-08-23 Thread Ross Patterson
It seems like ZServer/medusa/http_server.py is responsible for logging
requests to the access log/Z2.log and it only extracts the user from the
HTTP basic auth header.

I'd like to have the Z2.log reflect my PAS users so I started a branch at
http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/ that
hacks some request data.  You can see the meat of it in the following
changeset:

http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py?view=diffr1=79171r2=79170

I'm sure this is just about the worst way to do this.  :)  I just wanted
to get the discussion started.

I suspect that ZServer/medusa/http_server.py is only invoved for certain
Zope setups and that other Zope setups (twisted, etc.?) might log
differently.

So what would be a better way to approach this?  Does anyone else have a
solution to this problem?

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: Getting PAS users to show up in the access log/Z2.log

2007-08-23 Thread Ross Patterson
Ross Patterson [EMAIL PROTECTED] writes:

 It seems like ZServer/medusa/http_server.py is responsible for logging
 requests to the access log/Z2.log and it only extracts the user from the
 HTTP basic auth header.

 I'd like to have the Z2.log reflect my PAS users so I started a branch at
 http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/ that
 hacks some request data.  You can see the meat of it in the following
 changeset:

 http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py?view=diffr1=79171r2=79170

 I'm sure this is just about the worst way to do this.  :)  I just wanted
 to get the discussion started.

 I suspect that ZServer/medusa/http_server.py is only invoved for certain
 Zope setups and that other Zope setups (twisted, etc.?) might log
 differently.

 So what would be a better way to approach this?  Does anyone else have a
 solution to this problem?

I forgot to mention that one of my goals is to have this behavior be PAS
pluggable.  In particular, it seems obvious that user.getUserName()
should be the default that's used, but I have a need to use something
else, so I'd like to be able to write a plugin that does this.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: [Plone-developers] Getting PAS users to show up in the access log/Z2.log

2007-08-23 Thread Ross Patterson
Wichert Akkerman [EMAIL PROTECTED]
writes:

 Previously Ross Patterson wrote:
 Ross Patterson [EMAIL PROTECTED] writes:
 
  It seems like ZServer/medusa/http_server.py is responsible for logging
  requests to the access log/Z2.log and it only extracts the user from the
  HTTP basic auth header.
 
  I'd like to have the Z2.log reflect my PAS users so I started a branch at
  http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/ that
  hacks some request data.  You can see the meat of it in the following
  changeset:
 
  http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py?view=diffr1=79171r2=79170
   
  I'm sure this is just about the worst way to do this.  :)  I just wanted
  to get the discussion started.
 
  I suspect that ZServer/medusa/http_server.py is only invoved for certain
  Zope setups and that other Zope setups (twisted, etc.?) might log
  differently.
 
  So what would be a better way to approach this?  Does anyone else have a
  solution to this problem?
 
 I forgot to mention that one of my goals is to have this behavior be PAS
 pluggable.  In particular, it seems obvious that user.getUserName()
 should be the default that's used, but I have a need to use something
 else, so I'd like to be able to write a plugin that does this.

 I suspect that instead of doing yet another PAS plugin it would be more
 useful to make the zserver logging modular.

I don't suppose you could provide any suggestions for a direction for
this?  I really know very little about the zserver.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: [Plone-developers] Getting PAS users to show up in the access log/Z2.log

2007-08-23 Thread Ross Patterson
Wichert Akkerman [EMAIL PROTECTED] writes:

 Previously Ross Patterson wrote:
 Wichert Akkerman [EMAIL PROTECTED]
 writes:
 
  Previously Ross Patterson wrote:
  Ross Patterson [EMAIL PROTECTED] writes:
  
   It seems like ZServer/medusa/http_server.py is responsible for logging
   requests to the access log/Z2.log and it only extracts the user from the
   HTTP basic auth header.
  
   I'd like to have the Z2.log reflect my PAS users so I started a branch 
   at
   http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/ that
   hacks some request data.  You can see the meat of it in the following
   changeset:
  
   http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py?view=diffr1=79171r2=79170

   I'm sure this is just about the worst way to do this.  :)  I just wanted
   to get the discussion started.
  
   I suspect that ZServer/medusa/http_server.py is only invoved for certain
   Zope setups and that other Zope setups (twisted, etc.?) might log
   differently.
  
   So what would be a better way to approach this?  Does anyone else have a
   solution to this problem?
  
  I forgot to mention that one of my goals is to have this behavior be PAS
  pluggable.  In particular, it seems obvious that user.getUserName()
  should be the default that's used, but I have a need to use something
  else, so I'd like to be able to write a plugin that does this.
 
  I suspect that instead of doing yet another PAS plugin it would be more
  useful to make the zserver logging modular.
 
 I don't suppose you could provide any suggestions for a direction for
 this?  I really know very little about the zserver.

 Perhaps it would be interesting to see if the standard python logging
 module can be used to log requests as well.

Yeah, I was thinking about that.  If it were so, then at least I'd have
one way to modify the behavior more modularly.

One thing I can't quite think my way out of is that the logging is done
in the response._finish() in
ZServer/PubCore/ZServerPublisher.py::27(__init__).  The problem is this
happens well after a bunch of other tear down has already completed,
such as resetting the SecurityManager.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Is if sys.exc_info()[2].tb_next is not None: raise Evil? Concerns Products.GenericSetup, zope.configuration and others

2007-08-03 Thread Ross Patterson
While trying to use zope.app.modul.ZopePersistentModuleImporter, I ran
across an interaction with code that uses the following hack to try and
discern where an exception was raised.

 if sys.exc_info()[2].tb_next is not None:
 raise

The problem is occurs when an application provides an __import__
function written in python.  In that case then there is a tb_next for
all ImportError exceptions and this hack no longer indicates when the
error was deeper.  The same problem would occur if the hack were used
while catching AttributeError and there was a python implementation for
attribute access involved.

This hack counts on the fact that C code which raises an error doesn't
get included in the stack.  It counts on this fact, however, at points
where Python specifically allows application specific implementations
written in Python.  See the first paragraph of the __import__
documentation.

http://docs.python.org/lib/built-in-funcs.html#l2h-6

Here's a grep of the Zope 2.10 branch.  These first two are catching
TypeError:

./Zope/lib/python/zope/component/_api.py:73:if 
sys.exc_info()[2].tb_next is not None:
./Zope/lib/python/zope/interface/interface.py:644:if 
sys.exc_info()[2].tb_next is not None:

And these are catching ImportError:

./Zope/lib/python/zope/configuration/config.py:186:if 
sys.exc_info()[2].tb_next is not None:
./Zope/lib/python/zope/configuration/config.py:208:if 
sys.exc_info()[2].tb_next is not None:

For zope.configuration.config.ConfigurationContext.resolve, this hack
makes the difference between an ImportError being raised or a
ConfigurationError.  This inturn interacts with
zope.app.component.back35.LayerField.fromUnicode which only catches
ConfigurationError and doesn't catch ImportError.

And here's the GenericSetup 1.3 branch, it is also catching ImportError:

./Products/GenericSetup/utils.py:89:if sys.exc_info()[2].tb_next is 
not None: raise

Products.GenericSetup.utils._resolveDottedName is particularly
troublesome since the except ImportError is inside a while loop so when
__import__ is a python function and it raises ImportError,
_resolveDottedName ends up not continuing with the while loop as it
should.

It seems like the root of the problem is that Python doesn't provide a
way to distinguish between an error and a deeper error of the same type.
This hack is trying to make that distinction but it interferes with
places that Python specifically allows application specific
implementations written in Python.  Does that mean that code using this
hack is broken?

Also, zope.dottedname.resolve.resolve, zope.app.introspector.resolve,
zope.app.component.site.resolve, zope.app.module.resolve,
zope.configuration.name.resolve,
zope.configuration.config.ConfigurationContext.resolve,
Products.GenericSetup.utils._resolveDottedName.  How many versions of
this wheel do we need?  :)

Thoughts?  Corrections?  Suggested solutions.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] How can I tell if an object in a ZODB is being activated? Concerns zope.app.module.importer.

2007-08-03 Thread Ross Patterson
I'm working on zope.app.module.ZopePersistentModuleImporter.  As noted
in zodbcode.module.PersistentModuleImporter.__doc__, if the persistent
module registry which is consulted on import queries a persistent site
manager then the site manager must be activated before being queried or
a circular import problem occurs when the ZODB attempts to import the
globals necessary to activate the site manager.

The site manager will, however, eventually be deactivated, by a
transaction.abort() for example.  So I'm looking for a way that the
importer can know whether or now it's being called as a part of
activating the site manager.  I've written (and attached diffs for) a
very ugly function that inspects the frame stack to detect if the site
manager is being activated just to demonstrate what I'm looking for.

Is there a way to ask an object if it's being activated?  Or what might
be a better approach to solving this problem?

Ross

Index: __init__.py
===
--- __init__.py	(revision 78553)
+++ __init__.py	(working copy)
@@ -17,6 +17,7 @@
 
 __docformat__ = 'restructuredtext'
 import sys
+import ZODB.Connection
 import zodbcode.interfaces
 import zodbcode.module
 
@@ -24,6 +25,16 @@
 import zope.component
 from zope.app.module.interfaces import IModuleManager
 
+def isActivating(obj):
+if hasattr(obj, '_p_jar'):
+frame = sys._getframe(1)
+while frame is not None:
+if (frame.f_code is
+ZODB.Connection.Connection.setstate.func_code):
+if frame.f_locals['obj'] is obj:
+return True
+frame = frame.f_back
+return False
 
 class ZopeModuleRegistry(object):
 Zope-specific registry of persistent modules.
@@ -44,6 +55,9 @@
 for name,
 modulemgr in zope.component.getUtilitiesFor(IModuleManager)]
 
+def isActivating(self):
+return isActivating(zope.component.getSiteManager().utilities)
+
 # Make Zope Module Registry a singelton
 ZopeModuleRegistry = ZopeModuleRegistry()
 
@@ -66,10 +80,11 @@
 self._registry = registry
 
 def __import__(self, name, globals={}, locals={}, fromlist=[]):
-mod = self._import(self._registry, name, self._get_parent(globals),
-   fromlist)
-if mod is not None:
-return mod
+if not self._registry.isActivating():
+mod = self._import(self._registry, name, self._get_parent(globals),
+   fromlist)
+if mod is not None:
+return mod
 return self._saved_import(name, globals, locals, fromlist)
 
 
Index: persistence.txt
===
--- persistence.txt	(revision 0)
+++ persistence.txt	(revision 0)
@@ -0,0 +1,80 @@
+;-*-Doctest-*-
+===
+Persistencs 
+===
+
+If the site manager is persistent and is a ghost when an import is
+executed, then it will need to be activated before the import can be
+completed.  Activating the site manager requires importing the
+necessary globals so the importer needs to fallback to the builtin
+__import__ while the site manager is being activated.
+
+Setup a persistent module with a name in it.
+
+   import zope.app.module.manager
+   foo_manager = zope.app.module.manager.ModuleManager()
+   source = \n
+  ... foo = 'foo'\n
+  ... 
+   foo_manager.source = source
+
+   bar_manager = zope.app.module.manager.ModuleManager()
+   source = \n
+  ... bar = 'bar'\n
+  ... 
+   bar_manager.source = source
+
+Register the module with a persistent site manager that has been added
+to a ZODB.
+
+   import zope.app.testing
+   from zope.app.module import interfaces
+   from ZODB.DB import DB
+   from ZODB.DemoStorage import DemoStorage
+   root = zope.app.testing.setup.buildSampleFolderTree()
+   db = DB(DemoStorage())
+   connection = db.open()
+   connection.root()['root'] = root
+   root_sm = zope.app.testing.setup.createSiteManager(
+  ... root, setsite=True)
+   foo_manager = zope.app.testing.setup.addUtility(
+  ... root_sm, u'foo', interfaces.IModuleManager, foo_manager)
+   bar_manager = zope.app.testing.setup.addUtility(
+  ... root_sm, u'bar', interfaces.IModuleManager, bar_manager)
+
+Install the importer.
+
+   import zope.app.module
+   zope.app.module.importer.install()
+
+Now we can import the module.
+
+   import foo
+   foo.foo
+  'foo'
+
+Commit everything.
+
+   import transaction
+   transaction.commit()
+
+Deactivate the site manager and the utilities registry to turn them
+into ghosts by aborting a transaction.
+
+   from zope import interface, component
+   sm = component.getSiteManager()
+   ignored = zope.app.testing.setup.addUtility(
+  ... root_sm, u'baz', interface.Interface, lambda: 'baz')
+   transaction.abort()
+
+We can still import persistent modules.
+
+   import bar
+   bar.bar
+  'bar'
+
+Cleanup.
+
+   transaction.abort

[Zope-dev] Re: ZClassNG proposal makes Archetypes Easy.

2007-04-24 Thread Ross Patterson
Laurence Rowe [EMAIL PROTECTED] writes:

 I actually think TTW schema generation has some validity (so content
 types can be easily generated by users). Restricted Python (in python
 scripts) just kind of sucks though for being almost python but a
 little different. You could keep python code on the filesystem
 seperate and just write adapters to your TTW content types. (To make
 this work well would require versioned schemas to allow for changes
 and migrations - 
 perhaps zope.app.generations can help)

 For zope 3 based stuff this looks really interesting:
 http://agendaless.com/Members/tseaver/software/userschema/

I've done a bit of work reccently to get PersistentModules working
better with interfaces.  This allows me to have Zope 3 generated TTW and
stored in the ZODB.  I'm using this currently and it all seems to be
working great.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: Why are ZClasses Dead

2007-04-18 Thread Ross Patterson
Christopher Lozinski [EMAIL PROTECTED] writes:

 I keep getting these negative email messages.   Here is the most
 recent example.

 I think you should stop dreaming and face the reality. There is
 almost 
 nobody interested of the developer community in ZClasses.. I have no
 idea what your goal is with your ongoing ZClasses postings..you're on
 siding and there is no way back.

 My goal is to deliver maintain and expand the software my business
 needs to run.   In particular I am looking for a very very fast
 development environment, so whatever changes a client needs, I can
 make right away.  So I literally do not understand why people think
 ZClasses are dead.   Let me go through the possible reasons.  The last
 one is the real reason I think.

I think most of us are probably actually trying to save you the pain
we've gone through in the past.  

I know when I first started I think I had a lot of the same motives for
wanting to use ZClasses and as such disregarded the warnings I recieved
presuming my case was different.  But it's hard to convey to someone who
hasn't experienced the pain of ZCLasses and who hasn't experienced the
grace and speed of filesystem development with Zope and so it was hard
for me to understand until I tried it myself.

Months into my ZClass application, I ended up rewriting on the
filesystem and once I started to do so, *everything* was *so much
better*.  And that was when ZClasses were much better supported!

I think I understand your insistence and the motives behind it but
having no way to psychically transmit my experience, I can only say I'm
nearly certain your project and any future projects will do much
better on the filesystem.

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] Re: [Z3d] 747/ 2 Comment zope.app.interface PersistentInterfaceClass dependents broken

2007-01-12 Thread Ross Patterson
I've submitted a patch for zope.app.interface.PersistentInterfaceClass
and it looks like I could use the approach of zodbcode ModuleManagers
and zope.app.interface.PersistentInterfaceClass instances for what I
need.

Over the course of this work, however, I noticed
ZODB.persistentclass.PersistentMetaClass.  Does anyone have any sense
of how one might decide to use persistent modules versus
PersistentMetaClass?  Which cases are appropriate for which approach?
Is either body of code more of less active/up-to-date/well-maintained
than the other?

My specific case is that I want to allow site administrators to create
new marker interfaces to be used to mark content and to register
adapters for.'

Ross

Collector: Zope 3 ... [EMAIL PROTECTED] writes:

 Issue #747 Update (Comment) zope.app.interface PersistentInterfaceClass 
 dependents broken
  Status Pending, core/bug+solution medium
 To followup, visit:
   http://www.zope.org/Collectors/Zope3-dev/747

 ==
 = Comment - Entry #2 by rossp on Jan 12, 2007 4:46 pm


 Uploaded:  persistent-interfaces-fix.diff
  - 
 http://www.zope.org/Collectors/Zope3-dev/747/persistent-interfaces-fix.diff/view
 a fix for all but the zope.interface.interface.InterfaceClass provides 
 declaration weak reference bug
 
 = Request - Entry #1 by rossp on Jan 12, 2007 4:44 pm


 Uploaded:  persistent-interfaces-tests.diff
  - 
 http://www.zope.org/Collectors/Zope3-dev/747/persistent-interfaces-tests.diff/view
 zope.app.interface.PersistentInterfaceClass uses a PersistentDict for
 the dependents attribute instead of the WeakKeyDictionary used in
 zope.interface.interface.InterfaceClass.  There are a number of bugs
 associated with this approach not exposed in any tests.  Attached is a
 diff to the tests of zope.app.interface and zope.app.component to
 expose these bugs.

 Firstly, if IFoo is a zope.app.interface.PersistentInterfaceClass
 instance and zope.interface.directlyProvides(foo, IFoo), the
 declaraion can't be verified from a different ZODB connection with
 IFoo.providedBy(foo) due to the following.  When the ZODB is trying to
 unpickle the dependents attribute of IFoo, it procedes down the
 serialization of IFoo to the ProvidesClass instance representing the
 declaration.  It begins reconstituting the ProvidesClass instance,
 which calls IFoo.subscribe(provides) which accesses the dependents
 attribute of IFoo.  Since the ProvidesClass instance isn't persistent,
 it has no oid the ZODB circular reference check doesn't catch this
 circle.  As a result the fix is to make sure that the declarations
 instances in the dependents attribute are themselves persistent.

 Also attached is a diff to zope.app.interface that replaces
 PersistentInterfaceClass.dependents with a custom dict that converts
 non-persistent declarations being added to the dependents attribute
 into persistent versions of the same.

 This fixes the problem but is not optimal because there are then two
 instances for the same declaration, one in the ProvidesClass instance
 stored in the object's __provides__ attribute and the other in the
 dependents attribute of the PersistentInterfaceClass.

 It seems like the more appropriate solution would be to check for
 PersistentInterfaceClass instances in
 zope.interface.declarations.directlyProvides and use the persistent
 declaration classes for those declaraions.  Since
 PersistentInterfaceClass is in zope.app.interface and zope.interface,
 I wasn't sure which was the lesser of the two evils, so I restrained
 my changes to zope.app.  What might be a better solution?  Give me
 some feedback and I'll change the implementation.

 There's another problem with the
 zope.app.interface.PersistentInterfaceClass.dependents attribute.
 zope.interface.InterfaceClass.dependents is a WeakKeyDictionary so
 that declarations don't keep objects from being freed if the object is
 removed.  By using a PersistentDict for dependents, the declarations
 can keep an object from being freed from memory and/or the ZODB when
 the object is removed.

 My first patch also includes tests for this bug.  These tests seem to
 have exposed another unrelated bug.  An instance of a class that
 subclasses persistent.Persistent is declared that it
 zope.interface.directlyProvides a zope.interface.InterfaceClass
 instance and then the persistent object is added to the ZODB and
 committed.  Then if the persistent instance is deleted from the ZODB,
 the transaction is committed, and the ZODB is packed, and gc.collect
 is run, the ProvidesClass instance in the InterfaceClass instance
 still remains.  It does not, however, remain if the persistent
 interface was never added to the ZODB.

 I'm not sure if this represents a potential memory leak or not.  What
 confuses me is that it all behaves properly unless the persistent
 instance is added to the ZODB.  I noted the comment about weak
 referrences being added

[Zope-dev] Persistent Interfaces

2007-01-09 Thread Ross Patterson
I'm building a Zope2.10/Plone3 project using the CA wherever I can.
I'm relying heavily on marker interfaces and I'm at a point where I
need to allow a site administrator to create new marker interfaces to
be used to mark content.

I've looked at zodbcode, zope.app.module, and then finally found
srichter's SchemaUtility work in zope.app.schema that was removed by
jim in r69203.  I'm only minimally able to make sense of this stuff,
but none of it seems like what I'm looking for. I'd prefer to
programatically create new interfaces than fake modules or other code
object.  Something like::

 from new import classobj
 from zope.app.interface import PersistentInterface
 app.IFoo = classobj('IFoo', (PersistentInterface,), 
dict(__doc__='IFoo'))
 from zope.interface import directlyProvides
 directlyProvides(app.index_html, app.IFoo)

This actually all works except when the instance is stopped and
restarted.  When restarted, viewing index_html raises an error becuase
the app.IFoo.depdndents PersistentDict is missing it's
app.IFoo.depdndents.data attribute.  I see that there's a
zodbcode.patch.Wrapper used in zope.app.interface that seems like it's
intended to resolve this issue but I have no idea how to use it.

Actually, I don't have much idea what I'm doing at all, but I know
what I want.  :)  I want to create marker interface programatically in
response to a site administrators TTW actions and have them persist.
I want to mark persistent objects as providing those interfaces (and,
of course, have those declarations persist).  In response to other
site administrator TTW actions, I want to register adapters for
objects that provide those marker interfaces and have those
registrations persist (the adapters themselves need not persist, but
that would be nice).

I want this because the CA registry does exactly the kind of efficient
lookup I'd like to do in this case.  The only difference is that I
don't want the marker interfaces and adapter registrations to be
restricted to global code and I want them created through TTW actions.

srichter, did SchemaUtility do what I'm talking about here?  I see how
it managed the persistent state of an interface established through
global code, but I don't see how it could have resulted in the
arbitrary creation of new interfaces TTW.  Can you help me understand
a little more what's going on there?

Can anyone else advise on implementation directions or better design
patterns?

Ross

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: PDBDebugMode 0.1 Release

2006-03-16 Thread Ross Patterson
 You should really try using a editor/IDE that automatically shows the
 corresponding code along side the debugger, like Emacs' gud-mode which
 can be invoked with M-x pdb.  It rocks!

 I do that sometimes, but I lack sufficient wizardry to make it
 work with through-the-web scripts :-)
 But then, I don't write many of those anymore.

Put this in your .emacs:

(defvar gud-pdb-marker-regexp ^ 
\\(.*\\)(\\([0-9]+\\))\\([a-zA-Z0-9_]*\\|\\?\\)()\\(-[^\n]*\\)?\n)

That should do it :)

Ross
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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: PDBDebugMode 0.1 Release

2006-03-14 Thread Ross Patterson
 I've only just tried PDBDebugMode, very handy since you don't have
 to put set_trace() in your code (and remember to remove it).

Glad you like it :)

 I have also sometimes used Chris Withers' zdb product, 
 http://www.simplistix.co.uk/software/zope/zdb,
 which has some overlap in that it allows you to do this in restricted
 code, e.g. cmf scripts:

 from Products.zdb import set_trace
 set_trace()

 ... and, very usefully, once in the debugger you can use the l command
 to see the script source and it gets line numbers right.  So Ross, maybe

Oooh!  I'd love that.  I'll look into it.

You should really try using a editor/IDE that automatically shows the
corresponding code along side the debugger, like Emacs' gud-mode which
can be invoked with M-x pdb.  It rocks!

Thanks for the suggestion!

Ross
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


[Zope-dev] PDBDebugMode 0.1 Release

2006-03-13 Thread Ross Patterson
http://www.zope.org/Members/rossp/PDBDebugMode

PDBDebugMode - PDB post-mortem debugging on exceptions when debug-mode=on

If a relevant error log object is found, exceptions included in the
error log's ignored exception types will be ignored and the debugger
won't be invoked.

It also enables the import of the pdb module in unprotected code.

On encountering an error, the port-mortem debugger is invoked with the
error's traceback.  Once in the debugger you can examine objects,
variables, etc. at all levels of the call stack.  This is, of course,
extremely useful for debugging.

Since it only does anything if the instance is running with
debug-mode=on, I find this product useful not only for debugging on my
development instances, but also for doing quick emergency debugging on
a live production site.  IOW, if the problem is only reproducable on
the production site but not on my development instance, I'll restart
the production instance in debug-mode with pdb in emacs, reproduce the
error, inspect the call stack.

Ross Patterson
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 to trigger Zope externally (mail)

2003-03-07 Thread Ross Boylan
On Wed, Feb 26, 2003 at 05:37:17PM -0800, Andy McKay wrote:
 Or just write a simple HTTP post using Python. Have a look around for 
 the MailIn Product, or CMFMailIn which does this very simply and works 
 fine for low volume traffic (eg: fine listening to [EMAIL PROTECTED]).

Thanks.  I borrowed from CMFMailIn; I couldn't find the MailIn product.

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


[Zope-dev] How to trigger Zope externally (mail)

2003-02-26 Thread Ross Boylan
I am working on a poll/survey type product and want to handle
responses by email as well as the web.  If you have any advice about
the best architecture, I would appreciate it.  I'm currently using
Zope 2.5 on Linux, though it would be nice if the solution weren't too
platform dependent.

Here are some options I have thought of.

1. Incoming mail goes to a pipe, which is a program that processes the
message.

I think the main drawback of this approach is that I would need to run
Zope on top of ZEO so that multiple processes could access the
database safely.  I'm also not sure how hard it would be to
reestablish the context of my product outside of regular Zope.

Aside from these concerns, this seems the most natural approach.

2. Incoming mail goes to mbox; via the regular zope web interface I
periodically point to the mbox and request that it be processed.

Ugly, but relatively simple.  Some locking and concurrency issues.
Likely to result in much slower response to mail.  Also, there could
be some problems distinguishing message boundaries; in practice,
probably not a problem.

3. Incoming mail goes to temp file or temp named pipe*.  The running
zope is tickled via http: with the name of the file/pipe, and
processes it from there.

*By temp named pipe I mean each mail would need a unique pipe name.
I think if I try to use a single named pipe I may have trouble if
multiple emails go down it around the same time.

4. Deliver the email to the running zope via some other protocol,
e.g., ftp.

I'm not sure how to set this up.

--

I welcome comments on these approaches, or others that are even
better!

Also, I would like the approach to be reasonably secure.

Thanks.

___
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] dupe column names not supported (Shared.DC.ZRDB) ?

2002-12-17 Thread Ross J. Reedstrom
On Tue, Dec 17, 2002 at 02:25:27PM -0500, Casey Duncan wrote:
 The semantics of Zope's database functionality is such that duplicate column 
 names are not (and probably never will be) possible in the same result set. 
 This is because Zope expects to access columns by name rather than position. 
 Therefore each one must have a distinct name. 

Oh, I understand the problem: just reporting that PostgreSQL isn't the
only one doing it.

 The only workaround I can see would be some sort of automatic renaming of 
 columns, but that sounds like a bad idea since it introduces some serious bug 
 potential if the columns are renamed differently then the application 
 expects.

Yeah, that'd suck.

 Just for curiousity, what is the use case for returning multiple columns with 
 the same name? Sounds dubious to me.

I'm not aware of a use case, per se. It comes about from implementing this 
bit of the SQL92 standard:


7.9.9.b) If the i-th derived column in the select list
 does not specify an as clause and the value
 expression of that derived column is a single column
 reference, then the column name of the i-th column
 of the result is C.

Note that that says 'C', not 'CR'. i.e. is _must_ be the undecorated 
column name, not the column reference (schema.table.column)

The next subclause (7.9.9.c) handles the case of it not being a single
column reference (like a function, or somthing), and says it's then
'implementation dependent' and only needs to be unique in the set of
tables referenced by the SQL. It's not clear whether that's supposed
to include the 'derived table' that is the output of this 'query
specification'.

Ross
-- 
Ross Reedstrom, Ph.D. [EMAIL PROTECTED]
Research Scientist  phone: 713-348-6166
The Connexions Project  http://cnx./rice.edu  fax: 713-348-6182
Rice University MS-39
Houston, TX 77005

___
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] Web Services Sprint???

2002-12-04 Thread Ross J. Reedstrom
On Wed, Dec 04, 2002 at 07:16:04AM -0800, Andy McKay wrote:
 Yes. Where are you located? I was thinking of organizing a west coast US
 sprint...

According to this email (about a month ago: 
http://lists.zope.org/pipermail/zope-dev/2002-November/017898.html )

He's in Southwestern Mississippi, which puts him closer to me than you - 
a Gulf Coast sprint? ;-) 

Ross

-- 
Ross Reedstrom, Ph.D. [EMAIL PROTECTED]
Research Scientist  phone: 713-348-6166
The Connexions Projectfax: 713-348-6182
Rice University MS-39
Houston, TX 77005

 - Original Message -
 From: Eric Roby [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 04, 2002 4:27 AM
 Subject: [Zope-dev] Web Services Sprint???
 
 
  There has been a (tiny) bit of chatter (over the last couple of months)
  regarding the status of Web Services in Zope.  Would anyone be
  interested in focusing the chatter into a full blown sprint?  We have at
  least three developers (here) that would be very interested.
 

___
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: Refresh trashes acquisition

2002-08-10 Thread Ross Boylan

On Sat, Aug 10, 2002 at 10:25:32AM +0100, Chris Withers wrote:
 Ross Boylan wrote:
 
 That was just the first few lines of the class definition to give a
 flavor.  Was your remark that it was wrong based on the assumption it
 was the entire implementation, or is there something obviously wrong
 with the part you see?
 
 Nothing wrong with the visible parts, how did you implement the append 
 (and other) methods?
 
 cheers,
 
 Chris
 
I didn't implement it, though I can't remember where I got it from.  I
think it's OK.  For example, here's append

def append(self, item):
self.data.append(item)
self._p_changed = 1


I hope that's not a ZODB 2 ism also!


___
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: Refresh trashes acquisition

2002-08-08 Thread Ross Boylan

I missed this in all the excitement, and have a follow-up below.
On Tue, Jul 30, 2002 at 04:57:07PM +, Florent Guillaume wrote:
 Ross Boylan  [EMAIL PROTECTED] wrote:
  My case was, however, subtly different.  a.__of__(b) got put in a
  PersistentList, which is essentially [] with a little extra help:
  # This code is a copy of the Python UserList.py, updated to support
  # persistence.
  
  from Persistence import Persistent
  
  
  class PersistentList (Persistent):
  
  isAPersistentList = 1
  
  def __init__(self, lst=None):
  if lst is None:
  self.data = []
  else:
  self.data = list(lst)
 
 This is not a correct PersistentList. Your object won't get stored to
 ZODB upon l.append(xx) or l.update.
 
 There is a correct PersistentList in the ZODB package of Zope 2.6 (in
 CVS).
 
 Florent
 

That was just the first few lines of the class definition to give a
flavor.  Was your remark that it was wrong based on the assumption it
was the entire implementation, or is there something obviously wrong
with the part you see?

___
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: Refresh trashes acquisition

2002-07-29 Thread Ross Boylan

On Mon, Jul 29, 2002 at 07:58:22AM +0100, Toby Dickenson wrote:
 On Saturday 27 Jul 2002 12:32 am, Ross Boylan wrote:
  On Sat, Jul 27, 2002 at 12:26:04AM +0200, Lennart Regebro wrote:
   From: Ross Boylan [EMAIL PROTECTED]
  
I don't follow that last paragraph.  Does it mean
1. acquisition created by a.__of__(b) doesn't survive transactions.
  
   Correct.
 
  Just to be sure I understand: so if c is persistent, and I say
  c.d = a.__of__(b)
 
 This is storing an acquisition wrapper as an attribute of c. 
 
 acquisition wrappers are not persistent. This will raise an exception if you 
 try to store c in ZODB.
 

I was able to store these things without raising an exception, though
not with the ability to reconstitute them reliably.

My case was, however, subtly different.  a.__of__(b) got put in a
PersistentList, which is essentially [] with a little extra help:
-
# This code is a copy of the Python UserList.py, updated to support
# persistence.

from Persistence import Persistent


class PersistentList (Persistent):

isAPersistentList = 1

def __init__(self, lst=None):
if lst is None:
self.data = []
else:
self.data = list(lst)
--

Either this case is different, or it is not the case that attempting
to store and acqusition wrapper raises an exception (in Zope 2.5.1).

___
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] Re: Refresh trashes acquisition

2002-07-25 Thread Ross Boylan

On Thu, Jul 25, 2002 at 12:09:35PM -0700, Gary Speer wrote:
 Dear Ross - 
 I strongly encourage you to switch to the [EMAIL PROTECTED] mailing list as this one is 
dedicated to next-generation product enhancement as opposed to peer user assistance.

I thought this list was for developers, including product developers,
while the other was for zope users.  Isn't that the case?

 
 The approach you are taking seems a bit convoluted and I, for one, do not understand 
the business/project objectives reason to construct the objects as you do and create 
the acquisition cvhallenge you hope to solve.  Perhaps you can elaborate on the goal 
you hope to accomplish so others can suggest the better tools and object containment 
structure to use.  It seems earlier design decisions have taken you to solving issues 
that might not exist with an alternative, more-naturally-zope-like approach.
 
 Gary
 

I suspect you are right that I may be going about this in an un-Zope
like way, so let me describe the goals at a slightly higher level.  My
immediate goal is to be able to do votes for a non-profit organization
I'm in.  Existing tools that I have found (include both non-Zope
things and the Zope Poll product) are not quite flexible enough.  For
example, I want to have several question in one poll (eliminatess most
of the non-Zope things) and I want to be able to have people rank
alternatives for some of the questions (Poll product doesn't have
this).

I'm trying to make something that has lots of little bits that can be
combined flexibly.  For example, one can combine a particular style of
question (yes/no vs ranking) with a way of tabulating the votes
(instant-run-off vs ranked pairs for ranked questions).

The part that's giving me trouble relates to how subitems are
handled.  Questions are subitems of a Ballot, and Response are
subitems of Questions.  There are two choices
1) what order should the items be presented in (e.g., original order
or a random order)?
2) how should they be labelled?  This in turn has two parts: do you
want arabic, roman, or letters for the labels, and what decoration
around that do you want--e.g., Question xxx: vs Issue xxx).

It seems natural to allow some of these options to be specified at a
high level of containment.  For example, one might have a preferred
numbering style for questions and another for responses that are set at
the level of the Ballot (or even higher, possibly).  Then, if you
wanted to, you could override these lower down.

Specifically, each question determines how to number its responses,
but the style it uses for numbering the responses will typically come
from a higher level.

This style of containment and optional overriding seemed to me exactly
what acquisition was all about, so I tried to do it with acquisition.
But it didn't work.  Based on previous responses, I've implemented a
containment hierarchy by hand.  This works.  Almost surely there is a
better way.

___
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] Refresh trashes acquisition

2002-07-23 Thread Ross Boylan

I find that when I refresh my product it destroys some of the
containment relationships.  Things start failing, and as far as I can
tell the only recovery is to completely rebuild the object.

This is a big problem, and if anyone could explain what is going on
and how to avoid it I would appreciate it.

Here is the result of aq_chain before the refresh:
[RankQuestion instance at 8dd5620,
OriginalSuborder instance at 8c9f8d8, EMailBallot instance at
8dfc870, __FactoryDispatcher__ instance at 8e73770,
ProductDispatcher instance at 83f0618, Folder instance at 8d5733

and after
[RankQuestion instance at 8dee2d0]

Interestingly, and object inside this retained some context:
Before: [RandomSuborder instance at 8df6248, RankQuestion instance at 8dd5620, 
OriginalSuborder instance at 8c9f8d8, EMailBallot instance at 8dfc870, 
__FactoryDispatcher__ instance at 8e73770, ProductDispatcher instance at 83f0618, 
Folder instance at 8d57330, Application instance at 8e44ae0, RequestContainer 
instance at 8ed53e8]

After: [RandomSuborder instance at 8be7128, RankQuestion instance
at 8dee2d0]

Notice that the new RandomSuborder instance (new, judging by the
address, though it should be the same object) points to the new
RankQuestion.  Unfortunately, I need to go a little further than that
to get the variable I'm looking for :(.

It may be relevant that I am explicitly wrapping objects uses
a.__of__(b). I did this because I thought things weren't being wrapped
at all, but the results above show the problem is different: the
wrappers are lost on refresh.  The refresh changes nothing structural,
just some method code.

One thought that occurred to me is that it is not the changes to my
product classes that is causing the trouble, but the inclusion of some
of the items higher up the chain.

___
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] Extension class and __init__

2002-07-22 Thread Ross Boylan

I had the bright idea of defining a mixin class whose methods I
thought I could use in my regular Zope product classes:

class AMixin:
  def __init__(self):
 blah, blah blah

class B(AMixin, Persistent, Folder, ):
  def __init__(self):
# do some of my own stuff
AMixin.__init__(self)

This fails with the warning (as I recall) that the unbound method
AMixin.__init__ needs to be called with an instance as its first
argument.  (I've stripped the example down to give what I think are
the essentials).

self in the context of B is an Extension class, and I'm guessing this
is making AMixin unhappy because it's not.  I assume I'll have the
same problem with other methods that I attempt to access using
AMixin.foo(self).

Can anyone confirm this diagnosis?  And what's the best solution?

I have redefined things
class AMixin:
  def _mixin_init(self):
#stuff

class B(AMixin, .):
   def __init__(self):
#my own stuff
self._mixin_init(self)

and this seems to work, but I wonder if there's a way to get the
classes to play together better (maybe class AMixin(ExtensionClass):?
though since ExtensionClass is a type I guess that's not exactly it).

This was after already discovering that isinstance doesn't work with
ExtensionClass (which I see confirmed on the list, along with the fact
that ExtensionClass generally has a lot of rough spots and may be on
the way out).  This is with Zope 2.5.1.


___
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] Nesting Forms

2002-07-18 Thread Ross Boylan

On Thu, Jul 18, 2002 at 02:18:43PM -0400, Casey Duncan wrote:
 On Thursday 18 July 2002 02:06 pm, Ross Boylan wrote:
  Is there a way to get inheritance, so that, for example, 
  class C(B):
sect1 = DTMLFile(CSect2,globals())+B.sect1(self)?
  
  I don't think that syntax will work, but perhaps you see what I'm
  driving at--I want to include all the  previous stuff.
 
 Please explain what you mean by include. + to me implies append, surely not 
 what you were after.
 
 Perhaps a specific use case would make this clear.
 
 -Casey
 
I think append would be OK.  In most obvious case, the screen for A
looks like
foobar
xxx
 

And for B it would be 
foobar
xxx
 
zzz
aaa

And then for C
foobar
xxx
 
zzz
aaa
qqq 


And then if I extend A by adding some more data or info on the screen
foobar
new stuff
xxx
 


C ends up looking like
foobar
new stuff
xxx
 

zzz
aaa
qqq 



___
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] Nesting Forms

2002-07-18 Thread Ross Boylan

On Thu, Jul 18, 2002 at 08:41:02PM +0200, Dieter Maurer wrote:
 Ross Boylan writes:
   ...
   I would prefer a more elegant approach.  Perhaps I can define some
   method in A that the dtml will reference, and then B can override the
   method to add some extra stuff (the method would return a DTML
   snippet).
 That sounds good. It is how the ZMI works...

ZMI = Zope Management Interface (i.e., in the core app), or is this
something else?  At any rate, I'm not sure what you're referring to,
or where to look.

 
   First, I'm not exactly sure how to pick up the method from the DTML.
 There are two cases:
 
   *  view of an existing object
   
  then the object is the client of the primary view.
  Make all you snippets attributes of the object
  and you can simply access them by name.
 
  The ZMI does this. If necessary, look how it does.

The problem isn't just accessing them, but combining them.  Say C is a
subclass of B is a subclass of A.  Each subclass has the entire user
interface of its base class (aka superclass) and some extra stuff.

Either each class implements its novel stuff with a unique name.  In
that case, I still have to make a separate dtml file for each,
referencing the appropriate names (though your suggestion below helps
on that).

Or each has the same name.  Then the problem is how to get the
subclasses method to return its unique stuff plus everything in its
base class.  For vanilla methods that's not a big deal, but if each is
a DTMLFile, I don't think it will work.  More about that at the very
bottom.

 
   *  object creation form
   
  That's much more difficult. ZMI does not reuse fragments for
  this case.
 
  There is a partial solution for DTMLFiles, but it is not nice
  and restricted to DTML.
 
  DTMLFile constructors accept a dictionary with default
  name bindings. This way, you can customize your
  DTMLFile with different bindings according to context,
  e.g.
 
   addAForm= DTMLFile('dtml/addForm', globals(),
  comp1= AComp1
  comp2= AComp2
  ...)
   addBForm= DTMLFile('dtml/addForm', globals(),
  comp1= BComp1
  comp2= BComp2
  ...)

This suggests one semi-refined strategy: the file defines the maximal
interface, and then parts of it are guarded by dtml-if ...  tests on these
extra variables I pass in. I could even pass the class in, but I
suppose if I try to do issubclass(PassedInClass, MyApplicationClass)
in the dtml-if I will find that I lack security to access
PassedInClass, issubclass, or MyApplicationClass.


 
   Second, I'm not sure if this is the best solution.  For one thing, I
   would prefer to keep all my dtml in separate files, rather than
   defining it into my methods.
 You can have separate files and do something like:
 
 class YourProduct:
   
   mySnippet= DTMLFile('dtml/mySnippetFile',globals())
   
 

The problem comes if I stick the different interface segments in
different files, so A.dtml has the user interface for A and B.dtml has
just the added interface for B, a subclass of A.  But I want the user
interface for B to be the combination of the A and B parts.

 
 Dieter
 


___
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] Nesting Forms

2002-07-17 Thread Ross Boylan

I have a product with a number of classes that have subclasses.  It
seems natural to make the screens for the subclasses by extending
those of the superclass.  Can anyone suggest a good way to do that?

The naive approach is that I have a manage_edit_A.dtml that gives a
management screen for A.  If B subclasses A, I create
manage_edit_B.dtml by copying from the first file and then fiddling
with it.  Obviously, it would be desirable for a change in A to only
require changing a single file.

I would prefer a more elegant approach.  Perhaps I can define some
method in A that the dtml will reference, and then B can override the
method to add some extra stuff (the method would return a DTML
snippet).

First, I'm not exactly sure how to pick up the method from the DTML.
Second, I'm not sure if this is the best solution.  For one thing, I
would prefer to keep all my dtml in separate files, rather than
defining it into my methods.

Any suggestions?

P.S. I'd like to thank Toby Dickenson, Casey Duncan, and R. David
Murray for their very helpful responses to my previous question.


___
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] Adding Items to Object Manager and Folders

2002-07-16 Thread Ross Boylan

The Zope Developer's Guide and the API docs (Zope 2.5) present
different stories about how to add things to object managers.  I don't
really follow what the API stuff is doing.  This is a request for
clarification. 

Devguide says do
def addFunction(dispatcher, id):
   Create object and add to self
   p = SomeProduct(id)
   dispatcher.Destination()._setObject(id, p)

This makes sense, though, as commented at
http://www.zope.org//Members/michel/Projects/Interfaces/ObjectManager,
it relies on a private, undocumented method.  addFunction is in outer
scope of a module, and is hooked up wtih various calls in ___init__.py.

On the other hand, the ObjectManager API says to do
self.manage_addProduct['OFSP'].manage_addFolder(id, title).

First, what scope should that be done in?  Second, this seems to
create one product (OFSP) and then add a folder to it, so that it
creates two, nested products.

The API for Folder mentions manage_addFolder as a constructor, but
again the scope is unclear to me.  Presumably it needs to know what to
add it to, but that is not passed in.

Finally, the use of id in two places in the first code snippet (one
apparently associated with the container, the other with the object)
seems like an invitation to trouble.  Why is it done that way?

One reason I want to know this is that I'm considering having a
container that would automatically label (or set id) of its contents
(e.g., 'a' is first, 'b' is second).

Thanks for any light you can shed.



___
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] SQLite as a Light DB component for Zope and Python

2002-04-02 Thread Ross J. Reedstrom

On Tue, Apr 02, 2002 at 10:02:22AM -0500, Eron Lloyd wrote:
 Very interesting. I think I've read about this somewhere before. The
 claim of 4x faster than PostgreSQL raised my brow. It is true that
 Gadfly is becoming quite stale, and only supports a *very* limited
 subset of SQL. It also would be nice to see something a bit more robust
 than just shelve in the Standard Library. Gadfly is ok to begin a
 prototype in, but frustrating once you quickly hit a glass ceiling in
 functionality. I'm interested in seeing how well it can scale, versus
 Postgres, however. Any experience?

Scale, as in multiuser? Hardly at all: it's an SQL library that accesses
a single, textbased, flatfile for the entire database. From the FAQ,
multiple readers are allowed (on Unix), but the entire file (yes,
that's the whole database, not a single table) is locked for one backend
to write.

As a lightweight replacement for gadfly, it looks like it might be pretty
good. Note that the scripting language of choice of the author seems
to be Tcl, rather than Python. This probably explains the 'everything
is a string' approach :-) The speed comparisions with PostgreSQL are
very much an apples vs. fish sort of thing: the pgsql server was not
tuned _at all_, and does a whole lot more that was never tested, such
as multi-user writer access.

Ross

___
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] A thought for 2.6 about various leaks and memory problems

2002-03-19 Thread Ross J. Reedstrom

On Tue, Mar 19, 2002 at 12:07:12PM -0500, Adam Manock wrote:
 
 Interesting. One complication with that scheme is that ther is no
 convenient place to put caching. If it goes between Pen and Zope, you
 need many instances of your cache. If it goes between Pen and the
 clients, Pen's client-clustering is defeated because it sees only one
 client.
 
 Postgresql takes a similar (multi process) approach to achieving stability
 as apache.

As a long-time user and hanger-on of the PostgreSQL community, let me
take umberage at that statement. While it's true that postgresql uses a
multiprocess model, and that model does protect other backends from poorly
written C extensions, any inexplicable backend crashes are treated as
serious bugs by the pgsql core developers, tracked down and exterminated.
So, while the robustness of the system is enhanced by being multiprocess,
its stability is due to a rabid devotion to quality code (both design
and implementation), and bug hunting.

 
 see pg 4 of http://developer.postgresql.org/pdf/transactions.pdf
 
 Think shared memory caching behind the Zope worker processes ;-)

 And web server / proxy shared memory caching in front of the Zope worker
 processes.

Interestingly, a discussion about caching strategies for web client apps
has been going on in the postgresql HACKERS mailing list. There's signifcant
reluctance to putting it in the DB backend, because it's seen as the clients
job to cache.

 
 Of course, for stability, there is also the possibility of doing a OpenBSD
 style audit of the entire Zope (and possibly python) code base to make
 the code as close to perfect (and therefore stable) as the OpenBSD OS
  is ;-)   Volunteers?

Yeah, that's what I just described above, I think, for the pgsql core. So
it uses _both_.

Ross
P.S. note the PostgreSQL, postgresql, and pgsql are used interchangably
to refer to the entire RDBMS system and project. The first is 'official'
the last two are due to various levels of typing lazyness.

___
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] Transaction Bugs

2002-03-11 Thread Ross J. Reedstrom

Thank you Kapil! This solved the problem I was having with any
PostgreSQL ZDA and the exUserFolder product: now everthing works 
correctly.

Ross
P.S. The URL should be (note the extra 's'):

 http://www.zope.org/Members/k_vertigo/ShortStories/Transactions/



On Mon, Mar 11, 2002 at 05:17:18AM -0800, kapil thangavelu wrote:
 I wrote some unittests to investigate some odd transaction
 behavior i noticed while doing unittests of integrating non 
 sub transaction aware objects, and to insure proper txn behavior.
 these tests test the transaction system independent of the rest 
 of the zodb and test failure modes as well.
 
 i've found a few bugs. 
 

snip

 if you're using a rdbms with zope, i would recommend 
 installing the modified TM.py in replace of the exiting TM.py at 
 lib/python/Shared/DC/ZRDB/TM.py. i would appreciate any 
 feedback from rdbms users who were previously experiencing 
 problems.
 
 if this does not solve your problem, and you believe its
 the fault of the transaction system, please email me. i don't 
 use an rdbms with zope, but i'm happy to further investigate.
 
 cheers
 
 kapil thangavelu

___
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 transaction bug?

2002-03-08 Thread Ross J. Reedstrom

On Fri, Mar 08, 2002 at 08:55:56PM +0100, Dieter Maurer wrote:
 Ross J. Reedstrom writes:
   Boy, it's been a long time since I've hung around here. Anyway, I think
   we've found a bug somewhere in the zope transaction machinery.
 A really long time ago someone reported (just once) a bug in Zope's
 transaction system.
 
When I remember right, the problem occured when
there was an exception in the late stages of transaction processing.
This caused Zope to forget about aborting some other transactions.
 
 Not sure, whether this problem is still in modern Zope versions.
 Not sure, whether it is your problem...

Sounds similar, however we get it on rollback (Undo) regardless if
the Undo succeeds or not. Errors during normal 'forward' use seem to
abort correctly, _even after_ the connection gets in a bad state. So,
I'm guessing that the earlier problem may have been masked by a fixup
that we're now going around, in some way.

Ross

___
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 transaction bug?

2002-03-08 Thread Ross J. Reedstrom

On Fri, Mar 08, 2002 at 04:12:31PM -0600, Ross J. Reedstrom wrote:
 On Fri, Mar 08, 2002 at 08:55:56PM +0100, Dieter Maurer wrote:
  Ross J. Reedstrom writes:
Boy, it's been a long time since I've hung around here. Anyway, I think
we've found a bug somewhere in the zope transaction machinery.
  A really long time ago someone reported (just once) a bug in Zope's
  transaction system.
  
 When I remember right, the problem occured when
 there was an exception in the late stages of transaction processing.
 This caused Zope to forget about aborting some other transactions.
  
  Not sure, whether this problem is still in modern Zope versions.
  Not sure, whether it is your problem...
 
 Sounds similar, however we get it on rollback (Undo) regardless if
 the Undo succeeds or not. Errors during normal 'forward' use seem to
 abort correctly, _even after_ the connection gets in a bad state. So,
 I'm guessing that the earlier problem may have been masked by a fixup
 that we're now going around, in some way.

Further testing seems to indicate that there needs to be at least one
failed Undo attempt: after that, _any_ undo will trigger it.

Ross

___
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] zope transaction bug?

2002-03-07 Thread Ross J. Reedstrom

Hey all - 
Boy, it's been a long time since I've hung around here. Anyway, I think
we've found a bug somewhere in the zope transaction machinery. Every
now and then, a backend will get into 'idle in transaction' state. After
that, no work on that backend ever commits - the 'END' query just never
gets sent.

Careful analysis of the log files indicated that the ZpsycopgDA instance
started 'losing' proper transactional control after an admin who was
logged in via an exUserFolder that _also_ used that DA for authentication
used the management interface to undo a Zope transaction. The transaction
in question was merely an edit on a DTML file. No db interaction beyond
the authentication. Either a successful or an unsuccessful attempt to
rollback causes the problem.

Seems the Zope transactional machinery has 'forgotten' that our connection
needs to be told about transaction boundries.

We can make this happen at will, with Zope 2.4.3 or 2.5.0, exUserFolder
0.10.7, and ZpsycopgDA 1.0.5. It does require using the usAuth (User
Supplied Auth source) part of exUserFolder. Our developer who's somewhat
familiar with the guts of exUserFolder thinks that this is probably still
a bug in Zope, since all usAuth does is use customized ZSQL methods to
change where various strings are stored in the DB.

We're seeing similar problems with ZpopyDA, but haven't tested it
thoroughly to see if it's the same trigger.

I've constructed the test case for this: it's available at:

http://wallace.ece.rice.edu/xact-bug.tar.gz

That tarball contains an SQL schema script, zexp, and minimal instructions
for replicating the problem.

Anyone have any clues as to where to look to fix this? We're losing
commits to our database, whenever a developer tries to Undo something:
not good!

Ross
-- 
Ross Reedstrom, Ph.D. [EMAIL PROTECTED]
Executive Director  phone: 713-348-6166
Gulf Coast Consortium for Bioinformatics  fax: 713-348-6182
Rice University MS-39
Houston, TX 77005

___
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] Re: Python Base Classes, ZObjectManager, and Subobjects

2002-01-29 Thread Ross Patterson

I figured it out and I'm posting this so that the next hapless victim
might stumble upon this in a google search where I did not.  Long,
with suggestions that have probably already been made for the
improvements and clarification of ZClasses.

The problem is that I was trying to subclass in python a class that
was meant to be subclassed in a ZClass, namely
ZClasses.ObjectManager.ZObjectManager.  ZObjectManager is a mix-in
class that sets the ObjectManager class as its _zclass_ attribute, a
ZObjectManagerPropertySheets() class instance as its propertysheets
attribute, and sets the appropriate manage_options attribute.
ZClasses.createZClassForBase, however overrides all of this so
calling it on a mix-in class yeilds two layers of meta-classes and
everything goes #$*i%@!!

ZObjectManager gets registered using
App.ProductContext.registerZClass(), which is supposedly deprecated.
So I made a nearly exact duplicate of the ZObjectManager mix-in (which
violates DRY) that sets _zclass_ to a class that subclasses
ZCatalog.CatalogAwareness.CatalogAware and
ZClasses.ObjectManager.ObjectManager, and handles the propertysheets
and manage_options attributes.  I then register my mix-in with
registerZClass and the rest of my python base classes with
createZClassForBase.  It works, the subobjects management tab shows up
in any ZClass that directly or indirectly subclasses my python mix-in.

There are several glaring problems here, however.  One is the DRY
violation in duplicating the ZObjectManager mix-in.  The problem here
is that inheritance only applies to instances, so a class object that
subclasses a python ZClass doesn't inherit IN ITSELF the _zclass_,
propertysheets, manage_options, or any other attributes used by the
ZClass machinery at module import time, and thus it must be
duplicated.  Is there any way around this?

Second is the use of a deprecated function.  Of course, I'm not alone
on that one.  The ZClass module itself still depends on that function
for the registration of ZObjectManager.  So maybe it shouldn't be
deprecated, maybe it should be moved into ZClasses, maybe
createZClassForBase should be more intelligent?

Thirdly, its just all not very OO.  Of course, now that I've struggled
with all of this, I'm impressed as hell with ZClasses, I'm still
pissed at them, but I'm also impressed.  Its just difficult.  All the
same, however, there may well be room for more elegant ways of doing
all this.  For example, if I ever want my python base classes to
subclass another class like ZObjectManager that implements changes to
the ZClass management interface, I'm going to have to manually
reconcile the demands of the two subclasses on the ZClass machinery.
Ick.

Of course, having finished complaining, I'm going to do nothing about
all of this.  My excuse, figuring this out without so much as a
mailing list post to aid has put my project several days in arrears.
Of course, this is how I choose to learn is with a project to push me.
So there we have it.  My working *.py files are quoted below the
quoted history.

On Mon, 28 Jan 2002, Ross Patterson wrote:

 Nobody's really answering and I keep getting both closer and further
 looking at the ZClasses code.  As I understand it now,
 ZClasses.ZClass.createZClassForBase is supposed to address the ZClass
 meta class issues such as creating the _zclass_ in addition to the
 actual class and handling propertysheets.  So I would assume that my
 error lies somewhere in there, but I can't figure it out.

 A few more notes, when I create a ZClass that subclasses my python base
 class which in turn subclasses ZClasses.ObjectManager.ZObjectManager,
 it creates a ZClass with a default View for Subobjects.  This
 seems to indicate that somewhere the subobjects propertysheet is being
 treated as an instance propertysheet rather than a propertysheet of
 the ZClass meta class.

 Also, when I create an instance from such a ZClass, trying to access
 the instance in the ZMI yields an authorization error.  Following is
 the traceback:

 Traceback (innermost last):
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 150, in
 publish_module
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 114, in
 publish
   File /usr/Zope/lib/python/Zope/__init__.py, line 158, in
 zpublisher_exception_hook
 (Object: blah1)
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 98, in publish
   File /usr/Zope/lib/python/ZPublisher/mapply.py, line 88, in mapply
 (Object: manage_workspace)
   File /usr/Zope/lib/python/ZPublisher/Publish.py, line 39, in
 call_object
 (Object: manage_workspace)
   File /usr/Zope/lib/python/App/Management.py, line 76, in
 manage_workspace
 (Object: blah1)
 Unauthorized: (see above)

 I would assume this happens because the
 propertysheets/subobjects/manage method listed in the view tab is not
 valid for the instance, but trying to call that method on the ZClass
 directly returns:

 Traceback (innermost last):
   File /usr/Zope/lib/python

[Zope-dev] Python Base Classes, ZObjectManager, and Subobjects (fwd)

2002-01-28 Thread Ross Patterson

I'm transitioning a product from pure ZClasses to a hybrid product python base
classes and ZClasses.  So this is my first time working with python
products.

I'm trying to setup a python base class to provide a central place to
subclass ZObjectManager and CatalogAware that I can rebase later
without the ZClass hassle.  But when I try to create a ZClass in the
product and subclass to one of my python base classes, I don't get the
subobjects tab in my ZClass.

Clearly I'm missing somthing basic here, but I have scoured the docs
and mailing lists for a clue before coming here.  BTW, I did find this
post earlier that no one seemed to reply to, and below that are my
actual python files.

From the quoted message I can see that I need to do something with the
_zclass_, propertysheets, and manage_options of my base class.  Is
this documented anywhere.  I just gave up on reading the code.

---quoted message---

I want to create a Python base class that inherits from the
ObjectManager and has the Subobjects tab in the ZClass management
screen.  Inheriting from OFS.ObjectManager.ObjectManager does not do
this - I need to inherit from ZClasses.ObjectManager.ObjectManager.

I still don't know how to have the Subobjects propertysheet thing
work.  I've tried the two ways I listed in my last email of doing
this, but I can't get it to work.

One way was:

class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
  

class ZMyObjectManager:
Mix-in for Object Management


_zclass_=myObjectManager

propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

manage_options=(
{'label': 'Subobjects', 'action'
:'propertysheets/subobjects/manage'},
)

and then register ZMyObjectManager as a base class in __init__.py.
The other way was:

class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

manage_options=(
{'label': 'Subobjects', 'action'
:'propertysheets/subobjects/manage'},
)

and register that as the base class.  Neither of them work.

-- 
Itamar S.T.  [EMAIL PROTECTED]

---end quoted message---


#!/usr/bin/python
# __init__.py

from ZClasses import createZClassForBase

from PartBase import PartBase
from SitePartBase import SitePartBase
from ProjectPartBase import ProjectPartBase

def initialize( context ) :
createZClassForBase( PartBase, globals(), 'ZCPPartBase' )
createZClassForBase( SitePartBase, globals(), 'ZCPSitePartBase' )
createZClassForBase( ProjectPartBase, globals(), 'ZCPProjectPartBase' )

#!/usr/bin/python
# PartBases.py

from ZClasses.ObjectManager import ZObjectManager
from Products.ZCatalog.CatalogAwareness import CatalogAware

class PartBases ( CatalogAware, ZObjectManager ) :

Base Classes for all ZCP Parts


#!/usr/bin/python
# PartBase.py

from PartBases import PartBases

class PartBase ( PartBases ) :

Base Class for ZCP Parts


#!/usr/bin/python
# Products/ZCapitalProjects/SitePartBases.py

from PartBases import PartBases

class SitePartBase ( PartBases ) :

Base Class for ZCP Site Parts


#!/usr/bin/python
# Products/ZCapitalProjects/ProjectPartBases.py

from PartBases import PartBases

class ProjectPartBase ( PartBases ) :

Base Class for ZCP Project Parts


-
| Ross Patterson[EMAIL PROTECTED] |
| Programmer/Analyst(831)459-2792   |
| Physical Planning  Construction  Fax:(831)423-7436   |
| UC Santa Cruz http:www2.ucsc.edu/ppc  |
-



___
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] Re: Python Base Classes, ZObjectManager, and Subobjects

2002-01-28 Thread Ross Patterson

Nobody's really answering and I keep getting both closer and further
looking at the ZClasses code.  As I understand it now,
ZClasses.ZClass.createZClassForBase is supposed to address the ZClass
meta class issues such as creating the _zclass_ in addition to the
actual class and handling propertysheets.  So I would assume that my
error lies somewhere in there, but I can't figure it out.

A few more notes, when I create a ZClass that subclasses my python base
class which in turn subclasses ZClasses.ObjectManager.ZObjectManager,
it creates a ZClass with a default View for Subobjects.  This
seems to indicate that somewhere the subobjects propertysheet is being
treated as an instance propertysheet rather than a propertysheet of
the ZClass meta class.

Also, when I create an instance from such a ZClass, trying to access
the instance in the ZMI yields an authorization error.  Following is
the traceback:

Traceback (innermost last):
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 150, in
publish_module
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 114, in
publish
  File /usr/Zope/lib/python/Zope/__init__.py, line 158, in
zpublisher_exception_hook
(Object: blah1)
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 98, in publish
  File /usr/Zope/lib/python/ZPublisher/mapply.py, line 88, in mapply
(Object: manage_workspace)
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 39, in
call_object
(Object: manage_workspace)
  File /usr/Zope/lib/python/App/Management.py, line 76, in
manage_workspace
(Object: blah1)
Unauthorized: (see above)

I would assume this happens because the
propertysheets/subobjects/manage method listed in the view tab is not
valid for the instance, but trying to call that method on the ZClass
directly returns:

Traceback (innermost last):
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 150, in
publish_module
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 114, in
publish
  File /usr/Zope/lib/python/Zope/__init__.py, line 158, in
zpublisher_exception_hook
  File /usr/Zope/lib/python/ZPublisher/Publish.py, line 89, in publish
  File /usr/Zope/lib/python/ZPublisher/BaseRequest.py, line 278, in
traverse
  File /usr/Zope/lib/python/OFS/PropertySheets.py, line 601, in
__bobo_traverse__
AttributeError: subobjects

I have also tried the two variations in the quoted message below.
Then I tried the two variations below except substituting
ZClasses.ObjectManager.ZObjectManager for
ZClasses.ObjectManager.ObjectManager.  All with the same results

Again, my goal is to be able create a ZClass that subclasses a python
base class that in turn subclasses
ZClasses.ObjectManager.ZObjectManager in such a way that the final
ZClass and any other ZClasses that subclass it have a subobjects tab
in the management view of the ZClass.  Thanks.

On Sun, 27 Jan 2002, Ross Patterson wrote:

 I'm transitioning a product from pure ZClasses to a hybrid product python base
 classes and ZClasses.  So this is my first time working with python
 products.

 I'm trying to setup a python base class to provide a central place to
 subclass ZObjectManager and CatalogAware that I can rebase later
 without the ZClass hassle.  But when I try to create a ZClass in the
 product and subclass to one of my python base classes, I don't get the
 subobjects tab in my ZClass.

 Clearly I'm missing somthing basic here, but I have scoured the docs
 and mailing lists for a clue before coming here.  BTW, I did find this
 post earlier that no one seemed to reply to, and below that are my
 actual python files.

 ---quoted message---

 I want to create a Python base class that inherits from the
 ObjectManager and has the Subobjects tab in the ZClass management
 screen.  Inheriting from OFS.ObjectManager.ObjectManager does not do
 this - I need to inherit from ZClasses.ObjectManager.ObjectManager.

 I still don't know how to have the Subobjects propertysheet thing
 work.  I've tried the two ways I listed in my last email of doing
 this, but I can't get it to work.

 One way was:

 class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
   

 class ZMyObjectManager:
 Mix-in for Object Management
 

 _zclass_=myObjectManager

 propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

 manage_options=(
 {'label': 'Subobjects', 'action'
 :'propertysheets/subobjects/manage'},
 )

 and then register ZMyObjectManager as a base class in __init__.py.
 The other way was:

 class MyObjectManager(ZClasses.ObjectManager.ObjectManager):
 propertysheets=ZClasses.ObjectManager.ZObjectManagerPropertySheets()

 manage_options=(
 {'label': 'Subobjects', 'action'
 :'propertysheets/subobjects/manage'},
 )

 and register that as the base class.  Neither of them work.

 --
 Itamar S.T.  [EMAIL PROTECTED]

 ---end quoted message---


#!/usr/bin/python
# Products/ZCapitalProjects/__init__.py

from ZClasses import createZClassForBase

from PartBases import

[Zope-dev] Establishing root objects in ZODB under Zope

2002-01-23 Thread Ross Boylan

I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk about 
how to handle a free-standing database, but I don't see info about how to 
use the one that Zope has already set up.  I recall there's some way to get 
a handle to the open database, but I don't recall exactly what.  Can 
anybody help me out?

If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
MyClassVariable = SomePersistentClass()
.
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of unrelated 
transactions (it's only some I want), and I think it can get zapped if I do 
various database compactions and cleanups.

Thanks.


___
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] Re: Establishing root objects in ZODB under Zope

2002-01-23 Thread Ross Boylan

At 09:37 PM 1/23/02 -0800, Ross Boylan wrote:
I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk 
about how to handle a free-standing database, but I don't see info about 
how to use the one that Zope has already set up.  I recall there's some 
way to get a handle to the open database, but I don't recall exactly 
what.  Can anybody help me out?

If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
 MyClassVariable = SomePersistentClass()
 .
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

I just realized that I can hang the persistent object off the item or 
folder that is my product.  I'm still curious what the other options are.


Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of 
unrelated transactions (it's only some I want), and I think it can get 
zapped if I do various database compactions and cleanups.

Thanks.


___
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] [Partial Solution] Re: Establishing root objects in ZODB underZope

2002-01-23 Thread Ross Boylan

At 09:37 PM 1/23/02 -0800, Ross Boylan wrote:
I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk 
about how to handle a free-standing database, but I don't see info about 
how to use the one that Zope has already set up.  I recall there's some 
way to get a handle to the open database, but I don't recall exactly 
what.  Can anybody help me out?

Continuing to  talk to myself I finally found some old notes.  For the 
record (unless things have changed)
conn = aPersistentObject._p_jar
will retrieve the connection.  One can then get the root with
conn.root()

Thanks to Jim Fulton who originally explained this to me.

I'm still wondering about class variables being persistent and the 
efficiency of PersistentList, if anyone has any comments.


If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
 MyClassVariable = SomePersistentClass()
 .
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of 
unrelated transactions (it's only some I want), and I think it can get 
zapped if I do various database compactions and cleanups.

Thanks.


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


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



[Zope-dev] Appropriateness of using ZODB transactions to sync databases

2001-10-17 Thread Ross Boylan

I am working on a membership application for a voluntary organization.
The database may be updated either by the national office or local
chapters.  For security, convenience, and hosting reasons it seems
best that locals work off their own copy of the database.

Periodically changes will need to be syncronized, in both directions.
I know that ZODB logs transactions.  Is exchanging transactions a
reasonable way to accomplish the syncronization?  If so, exactly how
do I go about grabbing them (it would be all since date x) and then
replaying them?

Thanks.

___
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] catalog upgrade - what about products which subclass zcatalog

2001-03-15 Thread Ross Lazarus

I just upgraded my site explicit ZCatalog objects using Chris's very
helpful http://www.zope.org/Members/mcdonc/HowTos/UpgradeToNewCatalog
instructions - but I have a bunch of catalog aware zclasses and some
zclasses which (eg zdiscussions things, based on ZDBase) use
Products.ZCatalog - given that the base class has changed, do they need
any tweaking to take advantage of the new b+tree code?

___
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] 2.30 help system authentication problem?

2001-01-30 Thread Ross Lazarus

I never allow anonymous to have any permissions in my zope root and I
have just noticed that I have to grant the view right to anonymous or
the help button gives me an authentication error - even when I'm logged
in as manager/owner.

Is it just me? New 2.30 source install on solaris 2.6 using an old
Data.fs (which has been through many upgrades...)

I'll put this in the collector if anyone can confirm it please.

___
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] Problems with offline MS IE 5

2000-10-22 Thread Ross Boylan

Applying W2K SP1 seemed to fix up this problem.  However, the original 
problem may not have occurred instantly, so perhaps it takes a bit more to 
bring it out.

At any rate, I also upgraded to IE 5.5, so I hope that will be the end of 
the bad caching behavior.

Thanks, Jens, for your response.

At 11:09 PM 10/19/2000, Ross Boylan wrote:
I recently tried doing some Zope development on a laptop and ran into a 
problem: when I updated a product the updates did not "take."  In 
particular, when I edited the text in a .dtml file and restarted Zope, I 
still saw the old text  when I got to the appropriate point (the file was 
wrapped in an HTMLFile() and used for creating a new instance of one of 
the products in the package).

I think I checked all of the following:
* the file was getting updated
* all instances of explorer were shut down
* MSIE options set to "Check for newer version of stored page on every 
visit to the page"

A notable peculiarity was that whenever I tried to access my local zope, I 
would get a "you are offline, do you wish to go online" message (I even 
used localhost as the machine name!).  I would say yes, it would say it 
couldn't connect and ask if I wanted to try again.  I said yes, but then I 
ran into the problems described above.

Zope 2.2.2 on MS W2K with MS IE 5.0.

Does this ring any bells with anyone?  Is it an IE problem?  a Zope 
problem?  an interaction?


___
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] Object references from dtml

2000-10-20 Thread Ross Boylan

I have a log composed of sublogs, and so on.  I would like for people to be 
able to see some kind of summary (e.g., short versions of the logs down n 
levels) on the screen and then click on one of interest and see a fuller 
display of it.

Is there a good way to do this using dtml?

I've thought of two approaches.  The "standard" zope way seems to be to 
make each log folderish, and give each entry an id.  Then I can embed the 
address in the html.  The problem with this is that I would have to make up 
the id's and add extra machinery that the logs don't really need.

I'm leaning toward a second approach, of getting an object id and putting 
it in the html.  This also raises some issue.
   * Will the id be stable in the face of the db potentially 
dematerializing objects underneath?
   * If I use a persistent id (_p_oid, I think), will that be stable?
   * (Also, I'll need to be sure everything has persisted, but I think I 
can do that by forcing a transaction end before getting the _p_oid).
   * Can I map from object id back to object?  (_p_jar.something or other)
   * Will this be robust across database changes (minimally, from ZODB to 
ZEO)?
   * Will the object id consist of characters which can be embedded easily 
in html?


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

2000-10-06 Thread ross

Yours is the third enquiry I've had about this in the past week !!!

You can do this in a very general way using wget which is freely
available and very configurable.

Another option is to look at ZMirror in
http://www.zope.org/Members/rossl/ZMirror - not because it will solve
all your problems, but because the code is certainly a useful starting
point.

Turns out that it's a non-trivial task to do this in completely general
way. 

I now tend to write very specific external methods based on the code in
zmirror.

good luck.

Vijay Pawar wrote:
 
 Hi,
 I saw your discussion article enclosed below:
 Do you have a Zope external method/ Python code to create static html from
 Zope. Any help is much appreciated.
 
 Thanks,
 Vijay
 
 [Zope] ANN: Experimental zope-static html mirror external method
 Dr. Ross Lazarus [EMAIL PROTECTED]
 Sat, 05 Jun 1999 22:35:04 +1000
 
 Previous message: [Zope] Changing default new document contents
 Next message: [Zope] A single value from SQL
 Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
 
 
 
 Anyone needing to write a static html rendition of a zope site to a file
 system is welcome to try a very rough pre-alpha external method.
 
 fileme.py and fileme.txt are available via anonymous ftp at
 rossl.gmp.usyd.edu.au - or ftp://rossl.gmp.usyd.edu.au/ if you need to
 use a web browser.
 
 A more stable product will eventually appear. Please only try this
 release if you like to live dangerouslywget is safer and can
 probably do a better job.
 
 Bug reports, fixes and constructive comments to [EMAIL PROTECTED]


___
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] zope2.2.2 - ZopeTime not available to users defined in acl_users belowthe root?the root?

2000-09-28 Thread ross

Here's a problem which bit me today. I'd delegated someone to manage a
Yihaw directory. zope 2.2.2 source running on a sun.

make a folder at the root (eg /foo) with an acl_user folder there
define a new user in the foo acl_user folder (eg foobar) with
manager/owner rights
add a dtml method to view ZopeTime 

(eg 
dtml-var ZopeTime
) 

view it and see the current time. It's owned by a real manager and it
works as expected.

Now, close your browser down and authenticate as foobar and try to view
the page. You'll get:

Zope Error
Zope has encountered an error while publishing this resource. 

Error Type: KeyError
Error Value: ZopeTime



Traceback (innermost last):
  File /udd/rerla/zope222/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
  File /udd/rerla/zope222/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /udd/rerla/zope222/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
(Object: Traversable)
  File /udd/rerla/zope222/lib/python/ZPublisher/Publish.py, line 171, in
publish
  File /udd/rerla/zope222/lib/python/ZPublisher/mapply.py, line 160, in
mapply
(Object: test)
  File /udd/rerla/zope222/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(Object: test)
  File /udd/rerla/zope222/lib/python/OFS/DTMLMethod.py, line 172, in
__call__
(Object: test)
  File /udd/rerla/zope222/lib/python/DocumentTemplate/DT_String.py, line
528, in __call__
(Object: test)
KeyError: (see above)

Note, it's not unauthorised - it's just not in the namespace.

ZopeAttributionButton is defined in the same Application.py but it works
fine. I even tried adding
ZopeTime__roles__=None to no avail.

What gives???

___
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] Why use apply(foo.__call__, ..)?

2000-09-01 Thread Ross Boylan

In looking over the code for ZWiki/ZC, I see a lot of places with the 
following construct:
apply(foo.__call__, some, arguments)
Why not just say
foo(some, arguments)?

Examples of the construct from ZWikiPage.py:
apply(self.aq_parent.standard_wiki_page.__call__,
   (None, REQUEST, REQUEST.RESPONSE))
or
apply(DTMLDocument.__call__,(self, self.aq_parent,
  REQUEST, REQUEST.RESPONSE))

[OK, in this case the question technically is why use apply(foo.__call__, 
(a, b, c)) instead of foo(a,b,c)? Hmmm...
x.foo(a, b, c) - foo.__call__(x, a, b, c).]

These requests are mostly, if not entirely, directed at 
WikiPages/Headers/etc, whose definition is, in part,
class ZWikiPage(DTMLDocument): #, CatalogAware):
 def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
 """Render a zwiki page, with standard header  footer
 """

I thought the use of keyword argument dictionaries in apply might explain 
this, but, as the two opening examples show, not all cases have 
keywords.  Second, even if they do one could say
aDocument(self, REQUEST, REQUEST.RESPONSE, kw).

I understand from Johan that this is "inherited" code (in the non OO 
sense), so I thought I'd throw this out as a general question.  Is there 
some subtlety of the interaction of Zope (acquisition, perhaps, or 
extension classes in general) and python that makes foo(x) and 
foo.__call__(x) have different meanings?
Is it something about standard_zwiki_page, which I notice is not a regular 
python variable?

I don't need the answer to this to do something; I'm just trying to 
understand how things work.

Thanks.




___
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: ANNOUNCE: Zope 2.2.1 released - breaks my zclass instances too.

2000-08-29 Thread Dr. Ross Lazarus

I'm a little confused - which is not unusual, so please bear with me.

I'm absolutely sure that NONE of the things which were broken in the
original Data.fs had the slightest/faintest connection with any of the
products I expunged. It was removing the cruft alone which fixed the
problem. 

Doesn't this (and the other episode reported by Andy) raise the issue of
what we can do to ensure that a broken product or piece of a product
doesn't stop a healthy product and its instances (completely independent
in the sense of not using any of the broken product's base classes or
classes) from working? 

The instances which were broken were multi-level zclasses which included
ObjectManager and CatalogAware in their base classes. The relevant
products were entirely healthy. The things I got rid of included two
broken things which I never tried to fix (ZDConfera, ZDiscussions) plus
some left over stuff (ZopePTK, PTKBase, PTKDemo, Wizard, Membership,
LoginManager and a few other bits and pieces which I didn't need
although they didn't appear broken..) - none of which had any connection
to the broken zclasses in terms that I can understand - other than
sharing/breaking an otherwise healthy ZODB.


Brian Lloyd wrote:

 
  Lesson may be that a Data.fs which works with an earlier zope version
  may fail when upgrading to 2.2.1 - if so, try
 
 No - thats not the lesson (at least not the right one)... It looks
 like something in the "cruft" didn't want to be unpickled in the
 new installation (most likely due to a missing piece - a required
 product or base class needed by a piece of cruft didn't get moved
 to the new install). A Data.fs from an earlier version should
 always work with a later version so long as all add-ons are
 replicated in the new installation.
 
 Brian Lloyd[EMAIL PROTECTED]
 Software Engineer  540.371.6909
 Digital Creations  http://www.digicool.com

-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 114, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

___
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] ZWikiZC comments

2000-08-28 Thread Ross Boylan

Two substantive comments, and some editorial ones.

You write that you are thinking of different schemes for generating
paths and ids.  I suggest one of the things you consider is whether
your scheme will work if someone cuts the ZWikiZC and pastes it
somewhere else in the tree.

I'm not sufficiently versed in the different methods you discussed to
understand their implications--they seem to involve yet more
undocumented interfaces in Zope.


Second, I think the facility for email notification of changes is
really interesting.  It seems to me that a problem with the Wiki
concept (for some uses) is that they are very difficult to monitor for
changes.  Sending email, perhaps combined with diff, could help with
this.


Editorial comments:

"Summary" is spelled with an "a" (not summery).
"Product" is spelled with a "c" (not produkt).
Since these words are prominent in the documentation, and at least one
(summary) is to be a critical method, it would be good to clean this up.

The "!" in the paths baffled me (e.g., "!WikiPage").

Why Catalogs distinguish metadata from indices also eludes me.  It
should be explained in the Z/Catalog writeup, but since it's not, it
was there to bother me while I read your description.

It's hazardous to claim a performance advantage without benchmarks.


___
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] Re: ANNOUNCE: Zope 2.2.1 released - breaks my zclass instances too.

2000-08-26 Thread Dr. Ross Lazarus

Same here - same as 2.2.0b1 - at least my event.log now shows an error
message although the time/date stamp is STILL wrong 0-:

--
2000-08-26T06:03:20 INFO(0) ZServer Monitor Server (V1.8.4.1) started on
port 8099
--
2000-08-26T06:03:27 ERROR(200) ZODB Couldn't load state for
'\000\000\000\000\000\000\016\204'
Traceback (innermost last):
  File /usr/local/zope/zope221/lib/python/ZODB/Connection.py, line 447,
in setstate
  File /usr/local/zope/zope221/lib/python/ZODB/Connection.py, line 213,
in _persistent_load
(Info:
  File /usr/local/zope/zope221/lib/python/ZODB/Connection.py, line 154,
in __getitem__
(Info: ('\000\000\000\000\000\000*\252',
'(cExtensionClass\012ExtensionClass\012q\001(U\006ZDItemq\002(cZClasses.ZClass\012PersistentCl$
Could not load oid


--- In [EMAIL PROTECTED], Andy Dustman [EMAIL PROTECTED] wrote:
 Sadly, 2.2.1 seems to break all my ZClass objects. The Products themselves
 look fine, but any object made with them comes up as broken. The Class ID
 (in the HTML source) looked like it had a * in front of it. I retrograded
 to 2.2.0 and the problems went away.

-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

___
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] zope221b1 - zclass zexp import into clean database error

2000-08-12 Thread Dr. Ross Lazarus

More on testing zope221b1 - source tar, redhat 6.2
I seem to be the only one reporting problems on the list (0-:) - it
really is just me.
Thought I better try again - start with a clean slate

So, I restarted zope with a new empty Data.fs from the 221b1 source
distribution.
Started as superuser, made a real user with manager/owner rights.
Logged in as the real user, took ownership of the entire heirarchy.
Tried to import a zclass zexp file freshly exported from 2.2.0 that I've
been happily using with 2.2.0 and previously.
Traceback appears below

===
Zope Error
Zope has encountered an error while publishing this resource. 

Error Type: Permission mapping error
Error Value: Attempted to map a permission to a permission, Add SMP
Blocks, that is not valid. This should never happen. (Waaa). 





Troubleshooting Suggestions

The URL may be incorrect. 
The parameters passed to this resource may be incorrect. 
A resource that this resource relies on may be encountering an error. 
For more detailed information about the error, please refer to the HTML
source for this page. 

If the error persists please contact the site maintainer. Thank you for
your patience. 
 



Traceback (innermost last):
  File /usr/local/home/rossl/zope221b1/lib/python/ZPublisher/Publish.py,
line 222, in publish_module
  File /usr/local/home/rossl/zope221b1/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File /usr/local/home/rossl/zope221b1/lib/python/Zope/__init__.py, line
221, in zpublisher_exception_hook
(Object: Traversable)
  File /usr/local/home/rossl/zope221b1/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File /usr/local/home/rossl/zope221b1/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: manage_importObject)
  File /usr/local/home/rossl/zope221b1/lib/python/ZPublisher/Publish.py,
line 112, in call_object
(Object: manage_importObject)
  File /usr/local/home/rossl/zope221b1/lib/python/OFS/ObjectManager.py,
line 508, in manage_importObject
(Object: Traversable)
  File /usr/local/home/rossl/zope221b1/lib/python/OFS/ObjectManager.py,
line 263, in _setObject
(Object: Traversable)
  File /usr/local/home/rossl/zope221b1/lib/python/OFS/ObjectManager.py,
line 271, in manage_afterAdd
(Object: Traversable)
  File /usr/local/home/rossl/zope221b1/lib/python/ZClasses/ZClass.py,
line 422, in manage_afterAdd
(Object: ZBlockStore)
  File /usr/local/home/rossl/zope221b1/lib/python/OFS/ObjectManager.py,
line 271, in manage_afterAdd
(Object: Traversable)
  File /usr/local/home/rossl/zope221b1/lib/python/App/Factory.py, line
144, in manage_afterAdd
(Object: RoleManager)
  File
/usr/local/home/rossl/zope221b1/lib/python/AccessControl/PermissionMapping.py,
line 137, in manage_setPermissionMapping
(Object: RoleManager)
(Info: (['', 'Access contents information', 'Add Database Methods',
'Add Documents, Files, and Images', 'Add Documents, Images, and Files',
'Add External Methods', 'Add Folders', 'Add LDAPAdapter Object', 'Add
MailHost objects', 'Add Survey Creator', 'Add Sybase Database
Connections', 'Add TinyTable', 'Add User Folders', 'Add Versions', 'Add
Vocabularies', 'Add Z Gadfly Database Connections', 'Add ZCatalogs',
'Add ZWiki Pages', 'Add Zope Tutorials', 'Browse LDAPAdapter', 'Change
DTML Documents', 'Change DTML Methods', 'Change Database Connections',
'Change Database Methods', 'Change External Methods', 'Change Images and
Files', 'Change LDAPAdapter', 'Change TinyTable', 'Change Versions',
'Change ZWiki Pages', 'Change configuration', 'Change permissions',
'Change proxy roles', 'Change survey', 'Create class instances', 'Create
survey', 'Delete objects', 'Edit Factories', 'FTP access',
'Import/Export objects', 'Join/leave Versions', 'Manage Vocabulary',
'Manage Z Classes', 'Manage ZCatalog Entries', 'Manage properties',
'Manage users', 'Open/Close Database Connection', 'Open/Close Database
Connections', 'Query TinyTable Data', 'Query Vocabulary', 'Save/discard
Version changes', 'Search ZCatalog', 'Submit survey', 'Take ownership',
'Test Database Connections', 'Undo changes', 'Use Database Methods',
'Use Factories', 'Use mailhost services', 'View', 'View History', 'View
management screens'], 'Add SMP Blocks', 0))
Permission mapping error: (see above)

___
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] Calendar tag 0.9.6 breaks with 2.2.0b3??

2000-06-28 Thread Dr. Ross Lazarus

Thanks for the help.

Summary:
CalendarTag works fine in 2.1.6 but is broken in 2.20b3.
__call__ is mapped to render(self,md) - this is the same for all dtml
tags AFAIK.

The point that I find hard to understand is that namespace in DT_Util
has changed from 2.1.6 as follows

===2.1.6==
class namespace_: 
pass

def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes
are
provided as keyword arguments."""
r=namespace_()
d=r.__dict__
for k, v in kw.items(): d[k]=v
return r,

2.2.0b3
class namespace_:
__allow_access_to_unprotected_subobjects__=1

def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes
are
provided as keyword arguments."""
return apply(self, (), kw)

Now, I can easily put the old definition back and it might work - but
I'm not in a position to understand why the method has changed from what
looks like a simple dictionary construction to the apply function -
which doesn't seem to have anything to do with the namespace_ class !!

Brian??

Dieter Maurer wrote:
 The "self", more precisely, its "__call__" gets the keyword
 "linkDate" which it does not (no longer) likes to have.


 
 Dr. Ross Lazarus writes:
   Trying the new 2.2.0b3 zope.
   One zclass using ty's calendar tag now breaks with an error message I
   just cannot figure out -
  
   Error Type: TypeError
   Error Value: unexpected keyword argument: linkDate
  
 File /usr/local/zope/zope22b3/lib/python/DocumentTemplate/DT_Util.py,
   line 262, in namespace
   TypeError: (see above)
  
   I added  __allow_access_to_unprotected_subobjects__=1 to the CalendarTag
   class just in case.
  
   The offending line in CalendarTag.py is
  
   ns = namespace(self,
   date = date,
   mode = self.mode,
   firstday = firstday,
   setCalendar = self.setCalendar_,
   getCalendar = self.getCalendar_,
   linkDate = self.linkDate_
   )[0]
  
  
   namespace in DT_Util seems harmless enough -
  
   def namespace(self, **kw):
"""Create a tuple consisting of a single instance whos attributes are
   provided as keyword arguments."""
return apply(self, (), kw)
 The "self", more precisely, its "__call__" gets the keyword
 "linkDate" which it does not (no longer) likes to have.
 
 Dieter

___
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] 2.2.0b3 - try/except changed?

2000-06-26 Thread Dr. Ross Lazarus

This new beta has fixed some problems for me and the documentation on
the new security model for products has really helped...

However, I seem to be getting errors in previously (2.1.6) dtml
try/except structures.
1. dtml-except now seems to die unless there's an error_type parameter
(I usually don't need them...) - presumably a new buglet?

2. dtml-trydtml-var "fooZSQL"/dtml-try doesn't catch exceptions in
SybaseDA connected ZSQL method fooZSQL anymore?? I'm pretty sure this is
a change from 2.1.6 behaviour - and a change for the worse IMHO - it's
very useful to be able to expect a try/except structure to trap ALL
errorsgracefully

Could some kind soul confirm that it's not just me so I can pop this
into the collector please?
-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

___
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] change in product permissions/behaviour in 2.20b1

2000-06-21 Thread Dr. Ross Lazarus

The (heavily modified) Survey product from Piers Lauder is in heavy use
here.

In 2.1.x and in 2.20b1, the links in a folder view point to
[objectname]/manage_workspace

In 2.1.x, this does the right thing - if you have appropriate
permissions on the survey object, you get a management screen. Without
'View management screens' permission, you see a rendered survey form to
fill in. Fine.

In 2.20b1, this is now broken. No matter what permissions you have, the
[objectname]/manage_workspace link turns into a link to [objectname] and
you see the survey.

I've futzed with  __ac_permissions__ =  and added that little tip about
Globals.default__class_init__(Survey) without any joy.

Is this a bug, a deliberate change in behaviour or is it just me?



-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

___
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] Calling rendered objects from a product

2000-06-15 Thread Dr. Ross Lazarus

More than one way to skin that particular cat I'll warrant.

here's one cut from a heavily used external method to render a zope
dynamic page to a disk file.

import Globals
...
o = getattr(self,thingtorender)
rendered_doc = o(client=o,REQUEST=REQUEST,globals=globals())
...

Incidentally, why bother making a cache inside of zope? There are
perfectly good ones already available out there like squid. Wouldn't it
be easier to just dump the result from every query you encounter into a
disk file. 

Serve with apache but run a squid cache front end to zope. This would be
relatively easy to develop and could probably run very fast.

Refresh the static files as often as needed. How often do things change
in the data? 

If slowly, hourly re-rendering of queries as they arrive might work ok.

Given that there are tools to do this, it just might be easier with
static html than with live zope 


Carlos Neves wrote
 
  I need to call a rendered url, passed the REQUEST and wanted to do 
it directly
  to the self var. Not being able to do it, I have come with the 
solution of
  calling urllib with URL1, the called object and '?' + the query 
string... Not
   that fancy, but it works... slowly but smoothly.

___
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] Re: Strange ZClass permissions problem with 2.2a1

2000-05-18 Thread Dr. Ross Lazarus

Yep, trying to access a newly instantiated empty zclass instance
produces the same error. 

Looks like a bug. Email me if you want an exported version of my zclass
to poke and prod at...


Tres Seaver wrote:

 Does the problem repeat in the "vanilla" version if you just create a
 new instance of your ZClass, instead of importing the old pickle?  If
 so, it is definitely a "bug";  if not, it may be a "migration problem,"
 with a fix like the one Brian posted for recursively "re-ownering"
 Zope.org.


  If I take out manage_tabs from the offending ZClass index_html
  method, I can view index_html (but of course, I can't use the
  management stuff built in! making it rather useless), so that's
  where we're getting into trouble for sure.
  
  I've tried starting out with a vanilla 2.2a1 Data.fs and importing all
  the zclasses and the relevent folders - no difference.
  
  Anyone else seeing this?
  Is this worthy of the collector?
 

-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482  
Fax: (+61 2) 93516646   Email: [EMAIL PROTECTED]

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