[Zope-dev] Adding functions to _

2000-09-18 Thread Itamar Shtull-Trauring

I'm using CVS Zope, and I want to add a function of mine to _, so I have the
following code in a Product's __init__.py:

from log2vis import log2vis
from DocumentTemplate.DT_Util import d
d["log2vis"] = log2vis

However, when I call the function, I get an error about DocumentTemplate,
from which I discovered that when I call _.logvis('a_string'), instead of
the string being passed as the first parameter, _ is passed as the first
parameter to my function, forcing me to truncate it when calling log2vis:

from log2vis import log2vis
from DocumentTemplate.DT_Util import d

def log2vis_wrapper(*args, **kwargs):
return apply(log2vis, args[1:], kwargs)

d["log2vis"] = log2vis_wrapper


Any idea what could cause this strange behaviour?  it doesn't happen for
other functions inserted into _ in DT_Util.py.

-- 
Itamar S.T.  [EMAIL PROTECTED]
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C

___
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] I feel your Wiki Pain ;-)

2000-09-18 Thread Simon Michael

Chris Withers [EMAIL PROTECTED] writes:
 I wonder what Simon Michael is up to nowdays?

I have been visiting family.. I'll be back in the US next week.

Great thread here. I also feel this pain, grovelling around between
wiki, mailing list, newsgroup, message board, etc. 

I wonder if we should expose all messages, edits and annotations in
some RSS/RDF-like format, for easier syncing/monitoring/indexing of
the different forums and to faciliate alternate UIs.

-Simon

___
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] I feel your Wiki Pain ;-)

2000-09-18 Thread Toby Dickenson

On Fri, 15 Sep 2000 11:27:33 -0400 (EDT), Ken Manheimer
[EMAIL PROTECTED] wrote:


(Not sure that will scale, but creating new lists for each proposal
definitely won't scale.

I dont see this as a problem: You only create a new list when the
traffic for that proposal gets too great for zope-dev. Threading is
good enough before that point.

You cant do that with todays Wikis, which need to capture the whole
discussion right from the beginning (IMO)

Note that there's been a *number* of places in this recent WikiNG
discussion where' i've cited existing passages that directly address
people's points.  I don't mean to complain - i think that's one cost
increased by disconnecting the discussion and the document.

I think you (inadvertantly) provide evidence for my objection that
Todays Wikis fragment discussion. Speaking as the person who started
this thread, I didnt realise my comments would affect WikiNG until you
suggested the issue.

The inclusive nature of a mailing list is what makes it a useful
community resource.



Toby Dickenson
[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] I feel your Wiki Pain ;-)

2000-09-18 Thread Toby Dickenson

On Fri, 15 Sep 2000 11:40:09 -0400 (EDT), Ken Manheimer
[EMAIL PROTECTED] wrote:

Do you feel that weblogs are bad models for debates?

I find the wiki and weblog tools available today to be inferior to
mailman for debates, and it will take alot of work to develop WikiNG
into a serious contender. I suspect the sticky points will be:

1. The ability to read without continuous network connection.

2. A user interface that is not encumbered with transatlantic
   http round-trips for each user interaction.


I think they're [weblogs]
pretty good least-common-denominators.

i see them [weblogs and wikis] as better than just
email...

(Ive snipped those two comments out of context, and I hope it doesnt
misrepresent Ken)

I agree email alone is inadequate Please dont misunderstand me: I
am *not* advocating that.

Wikis work well for consolidating documents once a rough concensus has
been reached. My preference is that the discussion leading up to that
concensus takes place on zope-dev.


Toby Dickenson
[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] Calendar tag 0.9.22 released

2000-09-18 Thread IbaƱez Palomar Juan David


Hi all,

There's a new version of the calendar tag, I need feedback about
it, specially from those who use the "setCalendar('url_', ...)"
hook or the "linkDate(...)" function.


thanks,
david

___
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] HiperDOM xmlc

2000-09-18 Thread Evan Simpson

From: Phillip J. Eby [EMAIL PROTECTED]
[snip description]
 The effective external behavior of these two attributes, would be to let a
 web designer load and save any page or template they wished in the site,
 freely making changes to the header, footer, or various embedded elements
 thereof, and then save that *one* page, and have those style changes
 propagated throughout the relevant areas of the site.

Exactly.  You've just described the "components" aspect of this idea, which was left 
out of the
Paul's original post.  A component is just a tag marked with a special attribute that 
names it (and
its path, if it has been saved).  It can contain other components, and can have 
"slots" -- subtags
whose contents are not part of the component.  There is also the concept of "modes", 
which allows
you to have different versions of a template for different system states (shopping 
cart empty vs.
non-empty) that radically affect presentation.

 This could potentially be a "killer feature" for web designers.

Yep :-)

Cheers,

Evan @ digicool  4-am


___
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] Adding functions to _

2000-09-18 Thread Evan Simpson

From: Itamar Shtull-Trauring [EMAIL PROTECTED]
 However, when I call the function, I get an error about DocumentTemplate,
 from which I discovered that when I call _.logvis('a_string'), instead of
 the string being passed as the first parameter, _ is passed as the first
 parameter to my function, forcing me to truncate it when calling log2vis:

 Any idea what could cause this strange behaviour?  it doesn't happen for
 other functions inserted into _ in DT_Util.py.

When you stuff a function into "d", you're adding it to the class dictionary of 
DocumentTemplate, so
it effectively becomes a method of that class.  The first argument gets treated as 
"self", just like
in any other class method.

All of the functions in DT_Util are either builtins (which never get turned into bound 
methods) or
functions with a leading "self" parameter.

Cheers,

Evan @ digicool  4-am


___
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] soap and zope

2000-09-18 Thread Magnus Heino (Rivermen)


Has anyone done anything with soap and zope?

/Magnus Heino

___
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] Membership and Local Roles

2000-09-18 Thread Michael Bernstein

I posted this to the PTK list on Friday, but didn't get any responses
over the weekend, so I'm reposting here.

I feel that a barrier to Loginmanager and Membership becoming more
generally usable for site builders is it's current lack of support for
local roles. Specifically, members do not show up in the local roles
screen (manage_listLocalRoles) user list.

Through the magic of grep and find, I think I've identified the relevant
sections of code in Zope that need to be duplicated in Membership (or
maybe in LoginManager).

First I tracked down what seems to be the relevant section in
/lib/python/AccessControl/Role.py, in the section labeled 'Local roles
support':


def get_valid_userids(self):
item=self
dict={}
while 1:
if hasattr(aq_base(item), 'acl_users') and \
   hasattr(item.acl_users, 'user_names'):
for name in item.acl_users.user_names():
dict[name]=1
if not hasattr(item, 'aq_parent'):
break
item=item.aq_parent
keys=dict.keys()
keys.sort()
return keys


Then I tracked down the user_names attribute to
/lib/python/AccessControl/User.py, in the section labeled 'Private
UserFolder
object interface':


def user_names(self):
return self.getUserNames()


Well, that wasn't very helpful. searching a bit more and I find:


def getUserNames(self):
"""Return a list of usernames"""
names=self.data.keys()
names.sort()
return names


Experimenting a bit, I find that a normal user folder object responds to
an /acl_users/user_names URL with an error, but does respond to an
/acl_users/getUserNames URL with a list of user names.

And now I'm stuck. I *think* that LoginManager needs a getUserNames
method that cycles through the available User Sources and grabs a list
of
names from each, concatenating them into one big list to return. I'll
settle for some code that has the User Source name hard-wired in,
though.

However, IANAC (I Am Not A Coder), and I don't know how to do this. If
anyone can offer a cut-and-paste set of instructions to add this into
LoginManager or Membership, it would be greatly appreciated.

If I've missed something obvious or misunderstood the problem, please
tell me that too.

Thanks,

Michael Bernstein.

___
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] Can ZPatterns Plugins be used separately?

2000-09-18 Thread Kevin Howe

Hi, I'm wondering if it is possible to use ZPattern Plugins in a
non-ZPatterns Product? Allowance for Plugins would be a very useful feature
in many applications.

kh


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




Re: [Zope-dev] Can ZPatterns Plugins be used separately?

2000-09-18 Thread Steve Alexander

Kevin Howe wrote:

 Hi, I'm wondering if it is possible to use ZPattern Plugins in a
 non-ZPatterns Product? Allowance for Plugins would be a very useful feature
 in many applications.

You can use PlugIns without using the rest of ZPatterns, such as 
DataSkins and Racks. You still have to have the ZPatterns product 
installed, obviously. I can see this becoming even more useful when 
ZClasses work with PlugIns. This may be a while off, though.

I'm still in favour of splitting ZPatterns into separate DataSkins and 
PlugIns packages in the next feature release.

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


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




Re: [Zope-dev] Membership and Local Roles

2000-09-18 Thread Steve Alexander

Michael Bernstein wrote:

 I posted this to the PTK list on Friday, but didn't get any responses
 over the weekend, so I'm reposting here.
 
 I feel that a barrier to Loginmanager and Membership becoming more
 generally usable for site builders is it's current lack of support for
 local roles. Specifically, members do not show up in the local roles
 screen (manage_listLocalRoles) user list.
 
 Through the magic of grep and find, I think I've identified the relevant
 sections of code in Zope that need to be duplicated in Membership (or
 maybe in LoginManager).

I think you've found out why local roles don't work. Congratulations on 
a successful code hunting mission :-)

I don't know for sure, but I think the API for returning a list of users 
has been omitted intentionally. A LoginManager instance might "contain" 
(or rather, provide authentication to) thousands of users. Listing all 
of these would arguably break the management interface.

Perhaps what LoginManager (or Membership) needs is a way of stating, for 
each user, whether they should appear in the local-roles list. This 
could be a checkbox for each user, or it could be a method that gets 
called to specify the users that appear, for example, using a regular 
expression, or perhaps based on some quality of the user object.

You should still be able to use local roles, even now, by using an 
external method to add local roles where you need them, and explicitly 
give the user id. You just can't select from the management interface.

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





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




Re: [Zope-dev] Can ZPatterns Plugins be used separately?

2000-09-18 Thread Kevin Howe

Splitting into DataSkins and Plugins sounds like a really sensible idea, I
defintely put my vote in for that.

- Original Message -
From: "Steve Alexander" [EMAIL PROTECTED]
To: "Kevin Howe" [EMAIL PROTECTED]
Cc: "ZOPE-Dev Mailing List" [EMAIL PROTECTED]
Sent: Monday, September 18, 2000 2:28 PM
Subject: Re: [Zope-dev] Can ZPatterns Plugins be used separately?


 Kevin Howe wrote:

  Hi, I'm wondering if it is possible to use ZPattern Plugins in a
  non-ZPatterns Product? Allowance for Plugins would be a very useful
feature
  in many applications.

 You can use PlugIns without using the rest of ZPatterns, such as
 DataSkins and Racks. You still have to have the ZPatterns product
 installed, obviously. I can see this becoming even more useful when
 ZClasses work with PlugIns. This may be a while off, though.

 I'm still in favour of splitting ZPatterns into separate DataSkins and
 PlugIns packages in the next feature release.

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



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




Re: [Zope-dev] HiperDOM xmlc

2000-09-18 Thread Shane Hathaway

[EMAIL PROTECTED] wrote:
  So the standard_page_template default wrapping is an attempt at a
  compromise.
 
 It's wrong.

Please elaborate your position. :-)

Why is it wrong?

Shane

___
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] FYI: preliminary Zope 2.3 plan online...

2000-09-18 Thread Brian Lloyd

Hi all - 

For those interested, I've finally gotten the current plan for 
the next planned Zope feature release online on dev.zope.org:

http://dev.zope.org/Resources/zope_230_plan.html


Note that there is no planned date at this point. If there is 
something that you think should be on there (AND you are 
willing to volunteer to lead it!), please let me know.

Thanks!


Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 




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

2000-09-18 Thread Andy McKay

Is there an method that I can use as a hook when an object is destroyed? (Im
trying to save some _v_ data prior to destruction. Ive tried __del__ but
this doesnt seem to get called.

Thanks.

--
  Andy McKay, Developer.
  ActiveState.


___
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] Custom dtml tag

2000-09-18 Thread Andy McKay

Finally woke up on this problem.

Got this working by simply calling resolve_url upon the request object. But
what I want is a result that changes depending upon the object. Let's face
it, this can be acheived a whole lot easier by creating a method for the
objects and calling that.

So thats what Ive done and stayed away from using a dtml-tag.

Thanks for your help.

- Original Message -
From: "Brett Carter" [EMAIL PROTECTED]
To: "Andy McKay" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, September 13, 2000 9:51 AM
Subject: Re: [Zope-dev] Custom dtml tag


 Andy - looking up 'this' in a dtml method or document won't work
 unless you expose it in your python product/tag definition.  I'm
 talking about getting 'this' inside a dtml tag that I have defined
 myself (i.e. dtml-foobar/dtml-foobar).  If you want 'this'
 available in dtml, write an external method and just return 'self'
 def this(self): return self
 -Brett

  "Andy" == Andy McKay [EMAIL PROTECTED] writes:

 Andy Really? Ive looked up this and get nothing (an attribute error
actually) and
 Andy its not in globals. If that would work that would be great - but
a it
 Andy certainly doesnt seem to on a standard DTMLDocument / Method.

 Andy - Original Message -
 Andy From: "Brett Carter" [EMAIL PROTECTED]
 Andy To: "Andy McKay" [EMAIL PROTECTED]
 Andy Cc: [EMAIL PROTECTED]
 Andy Sent: Tuesday, September 12, 2000 4:17 PM
 Andy Subject: Re: [Zope-dev] Custom dtml tag


  Andy: here's what I've gleaned - in a dtml tag's render() method,
you
  get passed in self and a template dict, in my example let's call it
  'md'.  md is essentially a stack/dictionaryish object of the
*current*
  namespace - and one of the handy things that's always around in the
  namespace is the 'this' function, which returns the object on the
top
  of the stack.
 
  Just lookup 'this', run it, and there you have a reference to the
  calling object!  Ex:
 
  def render(self, md)
  this = md.getitem('this')
  callingObj = this()
  return "Calling object was %s" % (callingObj.id())
 
  Note I haven't tested this code.  Good luck!
  -Brett
 

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




Re: [Zope-dev] __del__

2000-09-18 Thread Chris McDonough

If it's an object in an objectmanager, you can define a
manage_beforeDelete() method on it (see ObjectManager.py).

How are you destroying it?

[EMAIL PROTECTED] wrote:
 
 Is there an method that I can use as a hook when an object is destroyed? (Im
 trying to save some _v_ data prior to destruction. Ive tried __del__ but
 this doesnt seem to get called.
 
 Thanks.
 
 --
   Andy McKay, Developer.
   ActiveState.
 
 ___
 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 )

-- 
Chris McDonough
Digital Creations, Publishers of Zope
http://www.zope.org

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

2000-09-18 Thread Andy McKay

I was hoping to have this method fired Zope is shut down, restarted etc and
not call it implicitly. The theory being if this object is cached it will
have to be unloaded at some point?

Ive used manage_beforeDelete() elsewhere and it works fine when Im
destroying an object whilst ZODB is still running.

Thanks.

- Original Message -
From: "Chris McDonough" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, September 18, 2000 2:32 PM
Subject: Re: [Zope-dev] __del__


 If it's an object in an objectmanager, you can define a
 manage_beforeDelete() method on it (see ObjectManager.py).

 How are you destroying it?

 [EMAIL PROTECTED] wrote:
 
  Is there an method that I can use as a hook when an object is destroyed?
(Im
  trying to save some _v_ data prior to destruction. Ive tried __del__ but
  this doesnt seem to get called.
 
  Thanks.
 
  --
Andy McKay, Developer.
ActiveState.
 
  ___
  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 )

 --
 Chris McDonough
 Digital Creations, Publishers of Zope
 http://www.zope.org

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




Re: [Zope-dev] __del__

2000-09-18 Thread Andy McKay

Wow thanks. I'll see what I can do. I can think of a whole bunch of uses for
that.

- Original Message -
From: "Chris McDonough" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, September 18, 2000 3:10 PM
Subject: Re: [Zope-dev] __del__


 Oh I see... objects don't get __del__ or manage_beforeDelete called on
 them when the ZODB is shut down, this only happens when they're
 explicitly deleted.  This is the wonder of transparent persistence :-)

 If you want things to happen only at Zope start and shutdown, I've had
 some success using an __init__.py that does things in an otherwise blank
 product in combination with the setting of a Python sys.exitfunc.  The
 following __init__.py in an otherwise blank Product directory sends an
 email when Zope is stopped or started:

 import os, sys, popen2, socket

 prefix = "StartStopNotifier:"

 def stop_hook():
 mailout(user, prefix, host, "Zope dev portal stop")
 if callable(existing_exitfunc):
 existing_exitfunc()

 def start_hook():
 mailout(user, prefix, host, "Zope dev portal start")

 def mailout(user, prefix, host, subject):
 cmd="/bin/mail %s -s '%s %s %s'  /dev/null" %
 (user,prefix,host,subject)
 popen2.popen2(cmd)

 user = os.environ.get('STARTSTOPNOTIFY', None)
 if user is not None:
 host = socket.gethostname()
 existing_exitfunc = getattr(sys, 'exitfunc', None)
 sys.exitfunc = stop_hook
 start_hook()


 [EMAIL PROTECTED] wrote:
 
  I was hoping to have this method fired Zope is shut down, restarted etc
and
  not call it implicitly. The theory being if this object is cached it
will
  have to be unloaded at some point?
 
  Ive used manage_beforeDelete() elsewhere and it works fine when Im
  destroying an object whilst ZODB is still running.
 
  Thanks.
 --
 Chris McDonough
 Digital Creations, Publishers of Zope
 http://www.zope.org



___
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] User objects on 2.2

2000-09-18 Thread Lalo Martins

On Sun, Sep 17, 2000 at 11:22:49PM -0300, Lalo Martins wrote:
 Why doesn't Anonymous have permission to call has_permission on
 itself? This is counter-intuitive to say the least...

Ooops... they have, kind of. The Anonymous user object inherits
the permissions from the top-level User Folder (/acl_users).
This is kind of weird and should be documented, but is usable.

(So, to allow Anonymous to call has_permission on itself you
have to enable "Access content information" for Anonymous on
/acl_users)

[]s,
   |alo
   +
--
  Hack and Roll  ( http://www.hackandroll.org )
News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo   mailto:[EMAIL PROTECTED]
 pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar

___
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] Membership and Local Roles

2000-09-18 Thread Michael Bernstein

Steve Alexander wrote:
 
 Michael Bernstein wrote:
 
  I posted this to the PTK list on Friday, but didn't get any responses
  over the weekend, so I'm reposting here.
 
  I feel that a barrier to Loginmanager and Membership becoming more
  generally usable for site builders is it's current lack of support for
  local roles. Specifically, members do not show up in the local roles
  screen (manage_listLocalRoles) user list.
 
  Through the magic of grep and find, I think I've identified the relevant
  sections of code in Zope that need to be duplicated in Membership (or
  maybe in LoginManager).
 
 I think you've found out why local roles don't work. Congratulations on
 a successful code hunting mission :-)

I *think* I've created a getUserNames python method that returns the
appropriate results:


Parameter list:
self

Body:

 user_ids=self.UserSource.getPersistentItemIDs()

 names=[]
 for i in user_ids:
 names.append(self.getItem(i))
 return names


I basically copied the Membership getMembers python method for this.

Guess what? It still doesn't work.

I don't understand the differences between the code I pasted above and
the code on the original getUserNames method (from :

def getUserNames(self):
"""Return a list of usernames"""
names=self.data.keys()
names.sort()
return names

Can anyone tell me what I need to fix?

Michael Bernstein.

___
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] Membership and Local Roles

2000-09-18 Thread Bill Anderson

Michael Bernstein wrote:
 
 Steve Alexander wrote:
 
  Michael Bernstein wrote:
 
   I posted this to the PTK list on Friday, but didn't get any responses
   over the weekend, so I'm reposting here.
  
   I feel that a barrier to Loginmanager and Membership becoming more
   generally usable for site builders is it's current lack of support for
   local roles. Specifically, members do not show up in the local roles
   screen (manage_listLocalRoles) user list.
  
   Through the magic of grep and find, I think I've identified the relevant
   sections of code in Zope that need to be duplicated in Membership (or
   maybe in LoginManager).
 
  I think you've found out why local roles don't work. Congratulations on
  a successful code hunting mission :-)
 
 I *think* I've created a getUserNames python method that returns the
 appropriate results:
 
 Parameter list:
 self
 
 Body:
 
  user_ids=self.UserSource.getPersistentItemIDs()
 
  names=[]
  for i in user_ids:
  names.append(self.getItem(i))
  return names

Returns a list of objects.

 I basically copied the Membership getMembers python method for this.
 
 Guess what? It still doesn't work.
 
 I don't understand the differences between the code I pasted above and
 the code on the original getUserNames method (from :
 
 def getUserNames(self):
 """Return a list of usernames"""
 names=self.data.keys()
 names.sort()
 return names

Returns a list of usernames.
 
 Can anyone tell me what I need to fix?

Unfortunately, I cannot yet.

--
Do not meddle in the affairs of sysadmins, for they are easy to annoy,
and have the root password.

___
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] Membership and Local Roles

2000-09-18 Thread Michael Bernstein

Michael Bernstein wrote:
 
 Steve Alexander wrote:
 
  Michael Bernstein wrote:
 
   I posted this to the PTK list on Friday, but didn't get any responses
   over the weekend, so I'm reposting here.
  
   I feel that a barrier to Loginmanager and Membership becoming more
   generally usable for site builders is it's current lack of support for
   local roles. Specifically, members do not show up in the local roles
   screen (manage_listLocalRoles) user list.
  
   Through the magic of grep and find, I think I've identified the relevant
   sections of code in Zope that need to be duplicated in Membership (or
   maybe in LoginManager).
 
  I think you've found out why local roles don't work. Congratulations on
  a successful code hunting mission :-)
 
 I *think* I've created a getUserNames python method that returns the
 appropriate results:

I have made some more progress (of a sort).

I added another Python Method to the LoginManager called user_names :


Parameter list:

self

Body:

return self.getUserNames()


As far as i can see, this should be functionally equivalent to the
user_names method in User.py:

def user_names(self):
return self.getUserNames()


But it doesn't work. On the bright side, I've managed to break the
manage_listLocalRoles local roles screen. This is the first time that
I've had any interaction with the local roles screen, so I guess now I
now I'm messing with the right stuff.

The error message I get is:

Error Type: AttributeError
Error Value: __hash__

Here is the traceback:

Traceback (innermost last):
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 222,
in publish_module
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 187,
in publish
  File /usr/local/zope/2-2-0/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
(Object: ElementWithAttributes)
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 171,
in publish
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/mapply.py, line 160,
in mapply
(Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/ZPublisher/Publish.py, line 112,
in call_object
(Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/App/special_dtml.py, line 121,
in __call__
(Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: manage_listLocalRoles)
  File /usr/local/zope/2-2-0/lib/python/DocumentTemplate/DT_In.py, line
630, in renderwob
(Object: get_valid_userids)
  File /usr/local/zope/2-2-0/lib/python/AccessControl/Role.py, line 360,
in get_valid_userids
(Object: ElementWithAttributes)
AttributeError: (see above)

Any ideas?

Michael Bernstein.

___
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] Returning a list of names from a Python Method

2000-09-18 Thread Michael Bernstein

Michael Bernstein wrote:
 
 Does anyone on the list know how to change the getUserNames
 Python method to return a list of names instead of a list of
 objects?
 
 The code in question is this:
 
   user_ids=self.UserSource.getPersistentItemIDs()
 
   names=[]
   for i in user_ids:
   names.append(self.getItem(i))
   return names

Ok, I solved this little problem (and of course it looks
obvious once I've done it):

   names=[]
   for i in user_ids:
   names.append(i)
   return names

Michael Bernstein.

___
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] Membership and Local Roles

2000-09-18 Thread Michael Bernstein

I figured out how to get this to work (finally).

In the acl_users LM, add the following two Python methods:

- getUserNames -

Parameter List:

self


Body:

 user_ids=self.UserSource.getPersistentItemIDs()

 names=[]
 for i in user_ids:
 names.append(i)
 return names




- user_names ---

Parameter List:

self


Body:

 return self.getUserNames()



And whatever users or members you've got that are stored
persistently within the User Source will appear in the local
roles screen (manage_listLocalRole).

Preliminary tests show that local roles defined for
LoginManager/Membership users work just as expected.

Thanks to Bill Anderson for pointing out the difference
between returning a list of objects and a list of names,
which was the critical bug in the getUserNames method.

Michael Bernstein.

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