Re: [Zope] how to install zope eggs

2007-07-09 Thread Andreas Jung



--On 10. Juli 2007 06:12:42 +0200 robert rottermann <[EMAIL PROTECTED]> 
wrote:



hi there,
I would like to install an egg that depends on zope eggs installed
(i18ndude)
this of course can easily be done with easy_install.
however afterwards non of my zope installations (and I have a number of
them on the system) are working anymore because python is picking up
some parts of the installed zope eggs.

with no-deps I can avoid installing the zope eggs but the i18ndude does
not work anymore.

how can I install zope eggs (or i18ndude that is) such that my zope
installations still work?
or phrased differently:
how can I install the zope eggs into a given zope instance?



You install Egg depending on Zope egg using the easy_install --no-deps
and you set PYTHONPATH to YOUR_ZOPE/lib/python

-aj

pgpk5w32GuS1W.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] how to install zope eggs

2007-07-09 Thread robert rottermann
hi there,
I would like to install an egg that depends on zope eggs installed
(i18ndude)
this of course can easily be done with easy_install.
however afterwards non of my zope installations (and I have a number of
them on the system) are working anymore because python is picking up
some parts of the installed zope eggs.

with no-deps I can avoid installing the zope eggs but the i18ndude does
not work anymore.

how can I install zope eggs (or i18ndude that is) such that my zope
installations still work?
or phrased differently:
how can I install the zope eggs into a given zope instance?

thanks
robert
begin:vcard
fn:robert  rottermann
n:rottermann;robert 
email;internet:[EMAIL PROTECTED]
tel;work:031 333 10 20
tel;fax:031 333 10 23
tel;home:031 333 36 03
x-mozilla-html:FALSE
version:2.1
end:vcard

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


Re: [Zope] grabbing the url query string

2007-07-09 Thread Andreas Jung



--On 9. Juli 2007 18:05:41 -0700 David Bear <[EMAIL PROTECTED]> wrote:


I would like to have a url that I can use to address a zope object
where I grab the query string and 'do something with it'. The issue is
I want to be able to do this for any/all zope objects. For example
lets say I have a zpt in my site called http://mzope.edu/zopeobject

I would like to be able to do http://mzope.edu/zopeobject?id=129292

and have a way to capture the value of 'id'..

The use case I have in mind is a set of emails where I hand out a url to a
page in a zope or plone zie that has a key or tag on it like the id
above. In one set of email id=abc, in another set the id=xyz. I want
to track 'clicks' based on which mailing generated the click. But I
want to be able to apply the 'method' to any/all zope objects.


Everything is stored within the REQUEST object (REQUEST.id in your case).

Please check with "The Zope Book" (this is one of the most basic 
functionalities of Zope).


-aj

pgp5gHDDzV1bm.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] grabbing the url query string

2007-07-09 Thread David Bear
I would like to have a url that I can use to address a zope object
where I grab the query string and 'do something with it'. The issue is
I want to be able to do this for any/all zope objects. For example
lets say I have a zpt in my site called http://mzope.edu/zopeobject

I would like to be able to do http://mzope.edu/zopeobject?id=129292

and have a way to capture the value of 'id'..

The use case I have in mind is a set of emails where I hand out a url to a
page in a zope or plone zie that has a key or tag on it like the id
above. In one set of email id=abc, in another set the id=xyz. I want
to track 'clicks' based on which mailing generated the click. But I
want to be able to apply the 'method' to any/all zope objects.

Does this make sense?

-- 
David Bear
phone:  602-496-0424
fax:602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] handling exceptions for external methods

2007-07-09 Thread David Bear
On Sat, Jul 07, 2007 at 08:11:29AM +0200, Andreas Jung wrote:
> >1 external methods run in the same interpreter as zope
> right
> >2 external methods have access to a larger namespace and therefor more
> >functionality
> 
> they have access to the *full* Python functionality
> >3 external methods inherit the same namespace available to scripts
> >running inside zope
> 
> inherit? Using 'self' as first parameter give you access to the
> current object (for acquisition).
> 
> >
> >4 external methods are not launched as forked or spawned child
> >processes
> 
> right
> 
> >
> >5 external methods do not have access to stdin/stdout
> 
> There is no usecase for accessing stdin from external methods and you might
> to use stdout only for debugging purposes only.
> 
> >
> >6 external methods must return only strings,
> 
> Nonsense. External methods can return anything.
> 

okay, I was thinking strictly in terms of using an external method in
a tal statment. All the examples I've seen in the zope book all have
external methods return html or xml as data that is sent back to the
browser. I never though of having an external method return a standard
python object back to a script and then have the script do something
with the object.

It would be really nice if there were more examples of using external
methods -- my concept of how to use them gets limited by the examples
that I see.

So, if there are more examples or use cases of external methods, I'd
appreciate a pointer to them.

Thanks.

> >but they may be unicode
> >string as long as they are valid xml string data
> 
> Nonsense. There is no contract in Zope telling some method
> to return XML at all.
> 
> >
> >Something that I don't understand is how to handle an exception. For
> >example, if I have an external method that appends data to the end of
> >a file, if there is an IOException how to I capture it and send a
> >message back to zope with something informative?
> 
> You must raise an exception if your failure is supposed to perform
> a ZODB abort operation. Otherwise catch the exception and return some 
> friendly error message back.
> 
> -aj
> 



-- 
David Bear
phone:  602-496-0424
fax:602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] catching shorter URLs

2007-07-09 Thread Chris Withers

Ken Ara wrote:

Aaron,

The Path Handler product
(http://www.zope.org/Members/NIP/PathHandler) is your
friend. 


Well, it would have been, but it's not necessary nowadays...


Normally, you would create a path handler called
'games' and point it to your display_game method. To
obtain the result you describe, you could move your
display_game code into index_html and test for a
path_to_handle, else display your 'real' index_html.


Nowadays, you can just use a normal python script instead of a path 
handler and process the traverse_subpath...


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: catching shorter URLs

2007-07-09 Thread J Cameron Cooper

Aaron Maupin wrote:
I'm trying to make pretty URLs for a game site I'm developing, and due 
to the hosting environment I'm somewhat limited in my Apache URL 
rewrites.  (I've tried the normal mod_proxy / mod_rewrite rules and they 
haven't worked in this environment.)


I'd like the visitors to see

http://games.mydomain.com/game-title

Whereas what's really being accessed is

http://www.mydomain.com/display_game?title=game-title

or any solution that allows me to query a relational database for a game 
title so I don't have to create hundreds of objects in Zope.


The only idea I have now is to use a Virtual Host Monster mapping to 
send visitors using the games.mydomain.com to a folder that contains a 
custom standard_error_message that reads the request object, figures out 
the game title, and queries the database but that's really inelegant.


Is there a way to inspect the request before Zope starts traversing 
objects?


Or any other ideas on how to accomplish what I want?  I'm not new to 
Zope, but I basically use it as a container for Python scripts and 
haven't delved too deeply into it otherwise... so I may be missing 
something obvious.


Why not just make the display_game method get its value from the path? 
That will simplify your task greatly. Here, 'traverse_subpath' is your 
friend.


  --jcc
--
Connexions
http://cnx.org

"Building Websites with Plone"
http://plonebook.packtpub.com

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

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] catching shorter URLs

2007-07-09 Thread Aaron Maupin

Dieter Maurer wrote:

> A "SiteAccess" "AccessRule" can do such things for you.
>
> Look around whether you find some documentation about "AccessRule"s
> and how to tweak the request object in such a rule.

Thanks Dieter!  That indeed did the trick.  It took a lot of digging 
around online (and several times undoing the last edit because it made 
the folder I was working in uneditable with the management interface) 
but in the end I was successful.


For posterity:

A Virtual Host Monster mapping sends any request with the "games" 
subdomain to a special folder with the following access rule:


#

request = context.REQUEST

#determine title (last part of URL)

url = request.other['ACTUAL_URL']
if len(url) > 0:
if url[-1] == '/':
url = url[:-1]
splitpath = url.split('/')
target = splitpath.pop()

#add title as form data to request object

request.form['gametitle'] = target

#rewrite path - display_game is a Python script in the root of
#Zope, so by adding its name to the namestack it will be found.
#Not added if I'm editing the script (hack) so I'm not locked out.

namestack = request.other['TraversalRequestNameStack']

if namestack[0][:6] != 'ZPytho' and namestack[0][:6] != 'manage':
request.other['TraversalRequestNameStack'] = ['display_game']

#

So far it works well.  I can visit

games.mydomain.com/Tetris

and

www.mydomain.com/display_game?gametitle=Tetris

interchangably.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] [supervise]

2007-07-09 Thread Sebastian Rahlf
Hi all!

I've been trying to set up a couple of zope instances with daemontools.
For some reason they just won't start up.

 2313 ?Ss 0:00 /bin/sh /command/svscanboot
 2320 ?S  0:00  \_ svscan /service
2334 ?S  0:07  |   \_ supervise zopeInstanz13log
13195 ?Z  0:00  |   |   \_ [supervise] 
 2336 ?S  0:07  |   \_ supervise log
13190 ?Z  0:00  |   |   \_ [supervise] 
 2338 ?S  0:07  |   \_ supervise zopeInstanz16log
13192 ?Z  0:00  |   |   \_ [supervise] 
2363 ?S  0:07  |   \_ supervise zopeInstanz13
13191 ?Z  0:00  |   |   \_ [supervise] 
 2366 ?S  0:07  |   \_ supervise zopeInstanz16
13193 ?Z  0:00  |   |   \_ [supervise] 
 2367 ?S  0:07  |   \_ supervise log
13196 ?Z  0:00  |   \_ [supervise] 
 2321 ?S  0:05  \_ readproctitle service errors: ...l:
unable to start zopeInstanz13/run: exec format error?supervise: fatal:
unable to start zopeInstanz16log/run: exec format error?supervise:
fatal: unable to start zopeInstanz16/run: exec format error?supervise:
fatal: unable to start log/run: exec format error?supervise: fatal:
unable to start zope Instanz13log/run: exec format error?supervise:
fatal: unable to start log/run: exec format error?

How can I find out what's wrong?

Cheers,
Sebastian

-- 
Sebastian Rahlf
Webentwickler
sebastian.rahlf [#] galileo-press.de


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


Re: [Zope] handling exceptions for external methods

2007-07-09 Thread Sascha Welter
(Fri, Jul 06, 2007 at 02:55:47PM -0700) David Bear
wrote/schrieb/egrapse:
> I've begun using external methods and am trying to better understand the
> context they run and and how to handle exceptions. I have concluded
> the following (and I don't recall reading some of these in any documentation)
> (please correct me if I'm wrong)
> 
> 1 external methods run in the same interpreter as zope
> 
> 2 external methods have access to a larger namespace and therefor more

... snip ...


You forgot this one:

0 external methods are just a hack, they are to be used only in
  exceptional cases. Learn how to make a filesystem based python product
  instead and waste as little time as possible on external methods.

Hope this helps!

Regards,

Sascha


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