From mr.hworth at gmail.com Tue Jan 1 19:20:27 2008
From: mr.hworth at gmail.com (Matt Hollingsworth)
Date: Tue Jan 1 19:20:36 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
Message-ID: <001001c84cd5$47aacca0$460aa8c0@home.msh>
Hello,
I'm new to developing for zope, and I have a quick question regarding some
best practices when using Javascript in zope applications.
I would like to use Ext JS (http://www.extjs.com/ ) in an application that I
am writing. It is a fairly extensive library, so I didn't really want to
copy/paste every single file into a dtml method. I looked all over the
place for some discussion on this subject, but only found things relating to
plone (which apparently has a javascript registry); however, I wish to stay
away from plone for this particular application.
What should I do to use these libraries? Is there a canned solution for
this sort of thing?
Thank you much!
-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080101/5be513ab/attachment.htm
From tseaver at palladion.com Tue Jan 1 21:16:21 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Tue Jan 1 21:16:34 2008
Subject: [Zope] Re: Best Practice for including Javascript in Zope
Applications
In-Reply-To: <001001c84cd5$47aacca0$460aa8c0@home.msh>
References: <001001c84cd5$47aacca0$460aa8c0@home.msh>
Message-ID: <477AF3F5.6030500@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matt Hollingsworth wrote:
> I'm new to developing for zope, and I have a quick question regarding some
> best practices when using Javascript in zope applications.
>
>
> I would like to use Ext JS (http://www.extjs.com/ ) in an application that I
> am writing. It is a fairly extensive library, so I didn't really want to
> copy/paste every single file into a dtml method. I looked all over the
> place for some discussion on this subject, but only found things relating to
> plone (which apparently has a javascript registry); however, I wish to stay
> away from plone for this particular application.
>
> What should I do to use these libraries? Is there a canned solution for
> this sort of thing?
The simplest route:
- Create a "File" object in the ZMI for each separate javascript
library (e.g., 'extlibrary.js').
- Upload the static content of the library file to that object.
- Include a link to the JS library in your master page template,
e.g.::
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHevP1+gerLs4ltQ4RAvjPAJ9DzvRiALdpBCJWmgk/Iy5NE+WTgACfSwkP
GpI0Nt2CC08qn7o4B+e/xcw=
=dijk
-----END PGP SIGNATURE-----
From lists at zopyx.com Wed Jan 2 00:16:06 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 2 00:16:20 2008
Subject: [Zope] Re: Best Practice for including Javascript in Zope
Applications
In-Reply-To: <477AF3F5.6030500@palladion.com>
References: <001001c84cd5$47aacca0$460aa8c0@home.msh>
<477AF3F5.6030500@palladion.com>
Message-ID:
--On 1. Januar 2008 21:16:21 -0500 Tres Seaver
wrote:
>>
>> What should I do to use these libraries? Is there a canned solution for
>> this sort of thing?
>
> The simplest route:
>
> - Create a "File" object in the ZMI for each separate javascript
> library (e.g., 'extlibrary.js').
>
> - Upload the static content of the library file to that object.
>
> - Include a link to the JS library in your master page template,
> e.g.::
>
>
>
Larger JS frameworks like Dojo tend to be split across several files and
directories. The fun starts when such frameworks load/reload stuff
using relative URLs. A co-worker using Dojo intensively had to invest
some time in order to integrate such a JS monster properly. As far as I
remember Extjs also uses multiple files (but not as much as Dojo does)..so
please check in advance.
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080102/1ab442da/attachment.bin
From lists at zopyx.com Wed Jan 2 00:18:10 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 2 00:18:19 2008
Subject: [Zope] Re: Best Practice for including Javascript in Zope
Applications
In-Reply-To:
References: <001001c84cd5$47aacca0$460aa8c0@home.msh>
<477AF3F5.6030500@palladion.com>
Message-ID:
--On 2. Januar 2008 06:16:06 +0100 Andreas Jung wrote:
>
>
> --On 1. Januar 2008 21:16:21 -0500 Tres Seaver
> wrote:
>
>
>>>
>>> What should I do to use these libraries? Is there a canned solution for
>>> this sort of thing?
>>
>> The simplest route:
>>
>> - Create a "File" object in the ZMI for each separate javascript
>> library (e.g., 'extlibrary.js').
>>
>> - Upload the static content of the library file to that object.
>>
>> - Include a link to the JS library in your master page template,
>> e.g.::
>>
>>
>>
>
> Larger JS frameworks like Dojo tend to be split across several files and
> directories. The fun starts when such frameworks load/reload stuff
> using relative URLs. A co-worker using Dojo intensively had to invest
> some time in order to integrate such a JS monster properly. As far as I
> remember Extjs also uses multiple files (but not as much as Dojo
> does)..so please check in advance.
>
Another point: consider using CMF and putting your library files into a
directory system view on the filesystem. This makes your life much easier.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080102/16394c6c/attachment.bin
From tino at wildenhain.de Wed Jan 2 01:10:39 2008
From: tino at wildenhain.de (Tino Wildenhain)
Date: Wed Jan 2 01:10:48 2008
Subject: [Zope] Re: Best Practice for including Javascript in
Zope Applications
In-Reply-To:
References: <001001c84cd5$47aacca0$460aa8c0@home.msh> <477AF3F5.6030500@palladion.com>
Message-ID: <477B2ADF.5060501@wildenhain.de>
Andreas Jung wrote:
>
...
>> Larger JS frameworks like Dojo tend to be split across several files and
>> directories. The fun starts when such frameworks load/reload stuff
>> using relative URLs. A co-worker using Dojo intensively had to invest
>> some time in order to integrate such a JS monster properly. As far as I
>> remember Extjs also uses multiple files (but not as much as Dojo
>> does)..so please check in advance.
>>
> Another point: consider using CMF and putting your library files into a
> directory system view on the filesystem. This makes your life much easier.
Or just upload via WEBDAV.
One of the biggest advantages of Zope is the isolation from physical
file system.
Regards
Tino
From mr.hworth at gmail.com Wed Jan 2 06:13:12 2008
From: mr.hworth at gmail.com (Matt Hollingsworth)
Date: Wed Jan 2 06:13:29 2008
Subject: [Zope] Re: Best Practice for including Javascript
inZope Applications
In-Reply-To: <477B2ADF.5060501@wildenhain.de>
Message-ID: <002a01c84d30$78008c90$460aa8c0@home.msh>
>Andreas Jung wrote:
>>
>...
>>> Larger JS frameworks like Dojo tend to be split across several files and
>>> directories. The fun starts when such frameworks load/reload stuff
>>> using relative URLs. A co-worker using Dojo intensively had to invest
>>> some time in order to integrate such a JS monster properly. As far as I
>>> remember Extjs also uses multiple files (but not as much as Dojo
>>> does)..so please check in advance.
>>>
>> Another point: consider using CMF and putting your library files into a
>> directory system view on the filesystem. This makes your life much
easier.
>
>Or just upload via WEBDAV.
>One of the biggest advantages of Zope is the isolation from physical
>file system.
>
>Regards
>Tino
Hello,
Thanks to everyone for your help. I thought about Tres's solution and
quickly discovered that I would be doing a *lot* of clicking/typing if I
wanted to upload all of the files necessary to make the ExtJS framework
available. I'll look into the WebDAV idea; I didn't think of that until
you mentioned it.
However, I came up with another possible solution that may be generally
useful after some (a lot actually) of coaxing. I threw this together in the
time between my new year's festivities :) : it's incredibly sloppy at the
moment, but before I worried about cleaning it up, I wanted to get some
feedback from you guys about it (pardon the annoying formatting problems):
def package_home(gdict):
"""Returns the location of the file that calls the function. You
must pass it globals() as the argument for it to work right.
:Parameters:
gdict : dict
A dictionary containing all of the global definitions for the
module. This is accessible via the python built-in function
globals()
:return: The fully qualified path for the directory in which the calling
module is residing
:rtype: string
"""
filename = gdict["__file__"]
return os.path.dirname(filename)
class FileSystemResource(Implicit,Item):
"""FileSystemResource is meant to make it easy to access file system
objects
through Zope. It works by taking over the object traversal process to
recursively return resources, simulating a directory structure, until
it finally reaches the end (__call__()), when it accesses the file
and returns it.
If you do
js = FileSystemResource()
in the class that you are publishing, then
http://www.domain.com/yourId/js/all.js
would return the contents of all.js.
:Authors: - Matt
:Date: 2007-1-1
"""
def
__init__(self,path,name,cache=True,persist=False,sync=True,rootdir=package_h
ome(globals())):
"""Create a FileSystemResource with the specified name"""
self.path = path
self.name= name
self.cache = cache
self.persist = persist
self.sync = sync
self.rootdir = rootdir
if cache:
self._cache = {}
#########
# Hooks #
#########
def __before_publishing_traverse__(self,obj,REQUEST):
"""Just print the request path so I can debug easier"""
#print "REQUEST.path: " + str(REQUEST.path)
print "REQUEST.path: " + str(REQUEST.path)
def __bobo_traverse__(self, request, key):
"""Takes the key, meshes it with the request, and
generates the object from that"""
full_path = os.path.join(self.path,key)
if self.cache:
if self._cache.has_key(key):
o = self._cache[key]
fsr = o[0]
mod_time = o[1]
file_size = o[4]
#If modtime isn't the same, refresh the resource
latest_access_time = time.localtime()
num_accesses = o[3] + 1
new_entry =
(fsr,mod_time,latest_access_time,num_accesses,file_size)
self._cache[key] = new_entry
return new_entry[0]
else:
o = FileSystemResource(full_path,name=None)
#Set the modification time
mod_time = "time" #TODO: Implement
latest_access_time = time.localtime()
num_accesses = 1
file_size = 0 #TODO: Implement
self._cache[key] =
(o,mod_time,latest_access_time,num_accesses,file_size)
return o
o = FileSystemResource(full_path)
print "Returning object " + str(o)
return o
###############
# ! End Hooks #
###############
def cleanCache(self):
#TODO: Not implemented (placeholder vars so I'll remember what's in
the tuples)
for key,value in self._cache.items():
file_location = key
file_obj = value[0]
mod_time = value[1]
latest_access_time = value[2]
num_accesses = value[3]
file_size = value[4]
def getResource(self,path):
"""Gets the resource sepcified by the given path. The path
should be relative to this particular object's path.
:Parameters:
path
The path (relative to this object's path) of the file or
folder that you are looking for
:return: Returns the content of the specified resource
:rtype: Zope File object
"""
#TODO: Implement
def __call__(self,REQUEST):
"""Gets the representation of the file on the filesystem"""
#TODO: Cache results
#TODO: Make it possible to use non-memory cached files
fname = os.path.abspath(os.path.join(self.rootdir,self.path))
type = guess_type(fname)[0]
if not os.path.exists(fname):
raise FileNotFoundException("File " + fname + " was not found on
the file system.")
print "Opening file " + fname
f = open(fname)
data = ""
for line in f:
data +=line
tmp_file = File(data)
ret = FileReadFile(tmp_file)
#Set the response content type
REQUEST.response.setHeader("Content-Type",type)
return ret.read()
def __str__(self):
"""Gets the string representation of this FileObject"""
return self.path
This class is working like a charm as it stands (I have
js=FileSystemResource("js","Javascript Repository") in my published object),
but it is terribly sloppily implemented for the time being, especially in
regard to binary files (doing for line... instead of going over chunks) and
to caching/memory issues (there is no caching except for the intermediate
objects and everything is loaded into memory first [big files = unusable]).
And someone could just pass ../'s to the path to get anywhere on the file
system they wanted, I suppose. All of these could easily be fixed of
course, but I wanted feedback before I put more than 30 minutes into the
prospect :)
Thanks for all your help!
-Matt
From tom at modscape.com Wed Jan 2 09:38:39 2008
From: tom at modscape.com (Tom Von Lahndorff)
Date: Wed Jan 2 09:38:40 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
In-Reply-To: <001001c84cd5$47aacca0$460aa8c0@home.msh>
References: <001001c84cd5$47aacca0$460aa8c0@home.msh>
Message-ID: <02F9AD6B-9B91-4634-A82F-331CFEE6D4D7@modscape.com>
On Jan 1, 2008, at 7:20 PM, Matt Hollingsworth wrote:
> Hello,
>
> I?m new to developing for zope, and I have a quick question
> regarding some best practices when using Javascript in zope
> applications.
>
> I would like to use Ext JS (http://www.extjs.com/ ) in an
> application that I am writing. It is a fairly extensive library, so
> I didn?t really want to copy/paste every single file into a dtml
> method. I looked all over the place for some discussion on this
> subject, but only found things relating to plone (which apparently
> has a javascript registry); however, I wish to stay away from plone
> for this particular application.
>
> What should I do to use these libraries? Is there a canned solution
> for this sort of thing?
>
> Thank you much!
>
> -Matt
> _______________________________________________
> 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 )
You can ftp the files to a "static" directory on the file system and
use LocalFS to access them.
http://wiki.zope.org/zope2/LocalFS
From victorsubervi at gmail.com Wed Jan 2 13:44:24 2008
From: victorsubervi at gmail.com (Victor Subervi)
Date: Wed Jan 2 13:44:28 2008
Subject: [Zope] Defining a Variable
Message-ID: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
Hi;
I have this in a page template:
Now, I thought that was the correct way to call the variable "num" (that is,
with the question mark: "?num"). Apparently, I'm mistaken. I've even tried
defining it this way:
to make sure that num was properly assigned. What am I missing? Also, if I
have a dir called "scripts" in which "getQuote" exists, and "scirpts" is in
the path, shouldn't that notation work okay?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080102/55b9dd20/attachment.htm
From lists at zopyx.com Wed Jan 2 13:55:02 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 2 13:55:10 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
Message-ID: <180883A52552CD055DD760AA@[192.168.0.24]>
--On 2. Januar 2008 14:44:24 -0400 Victor Subervi
wrote:
>
As in nearly all other programming languages methods are called
with parentheses - or?
>
>
> Now, I thought that was the correct way to call the variable "num" (that
> is, with the question mark: "?num"). Apparently, I'm mistaken. I've even
> tried defining it this way:
Not sure if using the '?' will working within a TALES expression. It will
at least work as the last item with an expression. However it will fail in
general if 'num' is an integer.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080102/e5f6c942/attachment.bin
From thedagdae at gmail.com Wed Jan 2 14:02:42 2008
From: thedagdae at gmail.com (Tim Nash)
Date: Wed Jan 2 14:02:46 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
In-Reply-To: <02F9AD6B-9B91-4634-A82F-331CFEE6D4D7@modscape.com>
References: <001001c84cd5$47aacca0$460aa8c0@home.msh>
<02F9AD6B-9B91-4634-A82F-331CFEE6D4D7@modscape.com>
Message-ID: <75c632a00801021102o5109b9b5vf5ac4507066ba055@mail.gmail.com>
I am writing an application that uses extjs as the front end and zope
on the back and they work together really well.
I am using a webserver to server the extjs library and everything else
comes out of zope. So far I have had no trouble with relative links
or files broken up in different locations. It may be because I have
fully committed to having an extjs front end. I typically serve a page
out of zope, it calls the extjs library as well as custom JavaScript
files. The web2.0 style page then makes multiple xhr calls back to
zope to load smaller html and json fragments. Works like a charm and
has the additional benefit of letting me cache the majority of the
front end in the webserver and in the users browser.
Have fun because you have just come across a wonderful
combination...extjs and zope!
Tim
On Jan 2, 2008 6:38 AM, Tom Von Lahndorff wrote:
>
> On Jan 1, 2008, at 7:20 PM, Matt Hollingsworth wrote:
>
> > Hello,
> >
> > I'm new to developing for zope, and I have a quick question
> > regarding some best practices when using Javascript in zope
> > applications.
> >
> > I would like to use Ext JS (http://www.extjs.com/ ) in an
> > application that I am writing. It is a fairly extensive library, so
> > I didn't really want to copy/paste every single file into a dtml
> > method. I looked all over the place for some discussion on this
> > subject, but only found things relating to plone (which apparently
> > has a javascript registry); however, I wish to stay away from plone
> > for this particular application.
> >
> > What should I do to use these libraries? Is there a canned solution
> > for this sort of thing?
> >
> > Thank you much!
> >
> > -Matt
> > _______________________________________________
> > 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 )
>
>
> You can ftp the files to a "static" directory on the file system and
> use LocalFS to access them.
> http://wiki.zope.org/zope2/LocalFS_______________________________________________
>
> 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 )
>
From mr.hworth at gmail.com Wed Jan 2 15:53:13 2008
From: mr.hworth at gmail.com (Matt Hollingsworth)
Date: Wed Jan 2 15:53:17 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
In-Reply-To: <75c632a00801021102o5109b9b5vf5ac4507066ba055@mail.gmail.com>
Message-ID: <004301c84d81$7ee05490$460aa8c0@home.msh>
Yep! I have had very good luck with it so far; my little hack that I posted
works like a (klutzy) charm and ExtJS is great with zope. The ExtJS folks
are very well organized, and the library is quite powerful. It's working
great. However, my application doesn't have quite the segregation that
yours does; ExtJS and zope (DTML in particular) are much more intermingled,
and can't be easily separated. This application is actually a frontend for
a Java library that controls instruments at CERN (a research lab I work
for), and I love the solution that it has presented. It works like a charm.
(in case you're curious, it makes use of a wonderful python library I ran
across called JPype (http://jpype.sourceforge.net) to execute the Java code)
I am going to be accessing Zope through apache with the VHM, but there are
multiple reasons why I don't want to serve the js through apache. This same
principle is the reason that I don't want to upload things through FTP or
WebDAV. I'm making a product, and I would like to keep it atomic, i.e., I
want the only install procedure to be "copy product folder to
instance/Products". Uploading via WebDAV, or hosting the javascript using
separate software, defeats that purpose.
The solution that Tom proposed (LocalFS) seems to be what I want, but the
problem is that I think it is way too out of date; it crashed my zope server
(2.10.5) when I installed it. It says nothing can be found after I add an
instance through the ZMI, and this is after I fixed a deprecated import (
from OFS.content_types import find_binary -> from zope.app.content_types
import find binary). I had to completely remove the product to get my Zope
instance to work again.
I'm getting the feeling that there isn't really a (recent) canned solution
for accessing file system content, which is... strange at best, considering
all the power that zope has at its disposal. You would think that accessing
the file system would be present just because it is so simple to do. I'm
not complaining, as I'm *very* happy with zope, I'm just surprised :). I
realize that zope's principle is to store everything in the database, but
this is unacceptable for content such as video files, right? I mean the
ZODB file would be absolutely humongous (and slow? I don't know for sure
how it's implemented).
If there isn't already a working solution, I would be happy to come up with
one; I could just hack out the parts of LocalFS that work, add a few
features, and repackage it into a new product. It's not difficult to do (my
little trivial solution already would work fine if I did a non-dumb
implementation of the file-serving logic), and as much as I would like to
use it for other projects, it would be worth my time. For example, I want
to make a little video/music server as a personal project unrelated to my
current one, and I really don't want to store things in the ZODB if I can
help it... 1 video = +1 gig ZODB? :S
I don't know much about zope obviously, so if I get some vehement objections
to this route, I'll pick another :)
Thanks!
-Matt
-----Original Message-----
From: Tim Nash [mailto:thedagdae@gmail.com]
Sent: Wednesday, January 02, 2008 2:03 PM
To: Tom Von Lahndorff
Cc: Matt Hollingsworth; zope@zope.org
Subject: Re: [Zope] Best Practice for including Javascript in Zope
Applications
I am writing an application that uses extjs as the front end and zope
on the back and they work together really well.
I am using a webserver to server the extjs library and everything else
comes out of zope. So far I have had no trouble with relative links
or files broken up in different locations. It may be because I have
fully committed to having an extjs front end. I typically serve a page
out of zope, it calls the extjs library as well as custom JavaScript
files. The web2.0 style page then makes multiple xhr calls back to
zope to load smaller html and json fragments. Works like a charm and
has the additional benefit of letting me cache the majority of the
front end in the webserver and in the users browser.
Have fun because you have just come across a wonderful
combination...extjs and zope!
Tim
On Jan 2, 2008 6:38 AM, Tom Von Lahndorff wrote:
>
> On Jan 1, 2008, at 7:20 PM, Matt Hollingsworth wrote:
>
> > Hello,
> >
> > I'm new to developing for zope, and I have a quick question
> > regarding some best practices when using Javascript in zope
> > applications.
> >
> > I would like to use Ext JS (http://www.extjs.com/ ) in an
> > application that I am writing. It is a fairly extensive library, so
> > I didn't really want to copy/paste every single file into a dtml
> > method. I looked all over the place for some discussion on this
> > subject, but only found things relating to plone (which apparently
> > has a javascript registry); however, I wish to stay away from plone
> > for this particular application.
> >
> > What should I do to use these libraries? Is there a canned solution
> > for this sort of thing?
> >
> > Thank you much!
> >
> > -Matt
> > _______________________________________________
> > 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 )
>
>
> You can ftp the files to a "static" directory on the file system and
> use LocalFS to access them.
>
http://wiki.zope.org/zope2/LocalFS__________________________________________
_____
>
> 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 )
>
From David.Bear at asu.edu Wed Jan 2 18:10:12 2008
From: David.Bear at asu.edu (David Bear)
Date: Wed Jan 2 18:10:16 2008
Subject: [Zope] looking for an easier way
Message-ID: <20080102231012.GF10970@asu.edu>
I'm writing an exteranl method to store data into a sql data base. In my
first attempts to do this I just had an external method dump whatever
zope gave it to a text file, then looked. I came up with the following
to split up the data the zope handed the external method and store it
an sql. This works. However, I'm thinking there must be an easier way
to capture what zope hands and external method.
Here's what I'm using now:
def ddmapper(data):
''' maps dictionary keys and vals handed from zope to
dictionary keys and vals which are attribute names of the table use to store the data
puts a pickle of all data into a zo -- zopeobject
nonce is a uniquifier
'''
now = DT.now()
pbuf = sio.StringIO()
pickle.dump(data, pbuf)
nonce = '%s:%s:%s:%s' % (now.year, now.month, now.day, now.second)
attribs = dict(fname=data['first-name'],
lname=data['last-name'],
email=data['email-address'],
studentid=data['student-id-number'],
accomodations=data['will-special-assistance-be-required'],
describe=data['describe-special-accomodations-needed'],
degree=data['degree'][0],
number=data['number-attending'],
key=nonce,
zo=pbuf.getvalue()
)
del(pbuf)
del(now)
return attribs
There must be an easier way to 'know' what zope is giving me and grab
the correct dictionary that has the form data in it. anyone have any
pointers?
--
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"
From dev101 at magma.ca Wed Jan 2 19:06:38 2008
From: dev101 at magma.ca (Jonathan)
Date: Wed Jan 2 19:06:40 2008
Subject: [Zope] looking for an easier way
References: <20080102231012.GF10970@asu.edu>
Message-ID: <04c701c84d9c$8301f680$677ba8c0@DESKTOP>
----- Original Message -----
From: "David Bear"
To: "zope"
Sent: Wednesday, January 02, 2008 6:10 PM
Subject: [Zope] looking for an easier way
> There must be an easier way to 'know' what zope is giving me and grab
> the correct dictionary that has the form data in it. anyone have any
> pointers?
A couple of ideas:
(i) use Zope marshalling to store all fields from an html form into a record
(dictionary)
(ii) get all form fields via: REQUEST.form.keys()
hth
Jonathan
From garito at sistes.net Thu Jan 3 04:59:53 2008
From: garito at sistes.net (Garito)
Date: Thu Jan 3 04:59:54 2008
Subject: [Zope] Ask for collaboration
Message-ID:
Hi!
I plan to create a product I call Zope Smart Manager that consist in a view
similar to freemind for Zope
You could see a picture of my prototype here:
http://blogs.sistes.net/Garito/images/ArbolYanged.png
The idea is create a series of monkey patches to all the products we are
interested to see as tree nodes and a series of javascript (prototype +
scriptaculous) for the "client side"
I plan this ZSM view will be my main work view with edition and creation
For that I need some help about how to create the simplest monkey patch and
the javascript objects
I have no experience with monkey patching zope nor javascript object but
I'll learn all the necessary skills if no one wants to help
Can you help me at any point?
Thanks!
--
Mis Cosas
http://blogs.sistes.net/Garito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080103/fa0a90fe/attachment.htm
From yurj at alfa.it Thu Jan 3 05:25:25 2008
From: yurj at alfa.it (Yuri)
Date: Thu Jan 3 05:19:45 2008
Subject: [Zope] transactional mail server for zope 2.7
Message-ID: <477CB815.9090909@alfa.it>
Hi all!
Is there a transactional mail server for zope 2.7. I mean, if some
transaction fail, it will not send the mail...
From lists at zopyx.com Thu Jan 3 05:23:48 2008
From: lists at zopyx.com (Andreas Jung)
Date: Thu Jan 3 05:24:00 2008
Subject: [Zope] transactional mail server for zope 2.7
In-Reply-To: <477CB815.9090909@alfa.it>
References: <477CB815.9090909@alfa.it>
Message-ID:
--On 3. Januar 2008 11:25:25 +0100 Yuri wrote:
> Hi all!
>
> Is there a transactional mail server for zope 2.7. I mean, if some
> transaction fail, it will not send the mail...
MailDropHost is a well-known secret.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080103/472da751/attachment.bin
From yurj at alfa.it Thu Jan 3 05:34:40 2008
From: yurj at alfa.it (Yuri)
Date: Thu Jan 3 05:29:00 2008
Subject: [Zope] transactional mail server for zope 2.7
In-Reply-To:
References: <477CB815.9090909@alfa.it>
Message-ID: <477CBA40.4080607@alfa.it>
Andreas Jung wrote:
>
>
> --On 3. Januar 2008 11:25:25 +0100 Yuri wrote:
>
>> Hi all!
>>
>> Is there a transactional mail server for zope 2.7. I mean, if some
>> transaction fail, it will not send the mail...
>
> MailDropHost is a well-known secret.
>
> -aj
Can I replace the standard mailhost without any problem in zope 2.7? Is
this the new standard in 2.11?
From jens at dataflake.org Thu Jan 3 05:47:32 2008
From: jens at dataflake.org (Jens Vagelpohl)
Date: Thu Jan 3 05:47:40 2008
Subject: [Zope] transactional mail server for zope 2.7
In-Reply-To: <477CBA40.4080607@alfa.it>
References: <477CB815.9090909@alfa.it>
<477CBA40.4080607@alfa.it>
Message-ID:
On Jan 3, 2008, at 11:34 , Yuri wrote:
> Andreas Jung wrote:
>>
>> --On 3. Januar 2008 11:25:25 +0100 Yuri wrote:
>>
>>> Is there a transactional mail server for zope 2.7. I mean, if some
>>> transaction fail, it will not send the mail...
>>
>> MailDropHost is a well-known secret.
>>
>> -aj
>
> Can I replace the standard mailhost without any problem in zope 2.7?
Yes.
> Is this the new standard in 2.11?
No, Zope 2.11 uses a Zope 3-based approach.
jens
From tseaver at palladion.com Thu Jan 3 07:22:08 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Thu Jan 3 07:22:07 2008
Subject: [Zope] Re: Ask for collaboration
In-Reply-To:
References:
Message-ID: <477CD370.3020501@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Garito wrote:
> Hi!
> I plan to create a product I call Zope Smart Manager that consist in a view
> similar to freemind for Zope
> You could see a picture of my prototype here:
> http://blogs.sistes.net/Garito/images/ArbolYanged.png
While I can see visual differences, how does this tree behave
differently than the one which the ZMI shows?
> The idea is create a series of monkey patches to all the products we are
> interested to see as tree nodes and a series of javascript (prototype +
> scriptaculous) for the "client side"
>
> I plan this ZSM view will be my main work view with edition and creation
>
> For that I need some help about how to create the simplest monkey patch and
> the javascript objects
I don't know why you think you need to moneky-patch anything: you
should be able to create such a view using the standard API supplied by
pretty much every existing Zope object. The ZMI tree code is here:
$ZOPE_HOME/lib/python/TreeDisplay/TreeTag.py
> I have no experience with monkey patching zope nor javascript object but
> I'll learn all the necessary skills if no one wants to help
>
> Can you help me at any point?
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHfNNw+gerLs4ltQ4RAqsAAJ0dpeS4NH7xRt6sH4fMHHcBnxcawQCfR4Mr
jEC5oHCat7/3EBgnalVVdFc=
=OaJS
-----END PGP SIGNATURE-----
From tseaver at palladion.com Thu Jan 3 07:22:08 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Thu Jan 3 09:05:20 2008
Subject: [Zope] Re: Ask for collaboration
In-Reply-To:
References:
Message-ID: <477CD370.3020501@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Garito wrote:
> Hi!
> I plan to create a product I call Zope Smart Manager that consist in a view
> similar to freemind for Zope
> You could see a picture of my prototype here:
> http://blogs.sistes.net/Garito/images/ArbolYanged.png
While I can see visual differences, how does this tree behave
differently than the one which the ZMI shows?
> The idea is create a series of monkey patches to all the products we are
> interested to see as tree nodes and a series of javascript (prototype +
> scriptaculous) for the "client side"
>
> I plan this ZSM view will be my main work view with edition and creation
>
> For that I need some help about how to create the simplest monkey patch and
> the javascript objects
I don't know why you think you need to moneky-patch anything: you
should be able to create such a view using the standard API supplied by
pretty much every existing Zope object. The ZMI tree code is here:
$ZOPE_HOME/lib/python/TreeDisplay/TreeTag.py
> I have no experience with monkey patching zope nor javascript object but
> I'll learn all the necessary skills if no one wants to help
>
> Can you help me at any point?
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHfNNw+gerLs4ltQ4RAqsAAJ0dpeS4NH7xRt6sH4fMHHcBnxcawQCfR4Mr
jEC5oHCat7/3EBgnalVVdFc=
=OaJS
-----END PGP SIGNATURE-----
From lists at zopyx.com Thu Jan 3 11:00:21 2008
From: lists at zopyx.com (Andreas Jung)
Date: Thu Jan 3 11:00:30 2008
Subject: [Zope] Re: Ask for collaboration
In-Reply-To: <477CD370.3020501@palladion.com>
References:
<477CD370.3020501@palladion.com>
Message-ID: <43CE1581855837F434DA44C4@[192.168.0.24]>
--On 3. Januar 2008 07:22:08 -0500 Tres Seaver
wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Garito wrote:
>> Hi!
>> I plan to create a product I call Zope Smart Manager that consist in a
>> view similar to freemind for Zope
>> You could see a picture of my prototype here:
>> http://blogs.sistes.net/Garito/images/ArbolYanged.png
>
> While I can see visual differences, how does this tree behave
> differently than the one which the ZMI shows?
This is just a tree rotated counter-clockwise.
>
>> The idea is create a series of monkey patches to all the products we are
>> interested to see as tree nodes and a series of javascript (prototype +
>> scriptaculous) for the "client side"
>>
>> I plan this ZSM view will be my main work view with edition and creation
>>
>> For that I need some help about how to create the simplest monkey patch
>> and the javascript objects
>
> I don't know why you think you need to moneky-patch anything: you
> should be able to create such a view using the standard API supplied by
> pretty much every existing Zope object. The ZMI tree code is here:
>
> $ZOPE_HOME/lib/python/TreeDisplay/TreeTag.py
The only issue I see here is the problem to render the graph from left to
right instead from top to bottom. There are several graph-drawing tools
available (best to start with Graphviz) that generate images or
HTML/Imagemaps.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080103/af621147/attachment.bin
From thedagdae at gmail.com Thu Jan 3 12:38:00 2008
From: thedagdae at gmail.com (Tim Nash)
Date: Thu Jan 3 12:38:03 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
In-Reply-To: <004301c84d81$7ee05490$460aa8c0@home.msh>
References: <75c632a00801021102o5109b9b5vf5ac4507066ba055@mail.gmail.com>
<004301c84d81$7ee05490$460aa8c0@home.msh>
Message-ID: <75c632a00801030938p41b75c57qff9104040b226d55@mail.gmail.com>
Matt,
Please keep us updated on your strategy for serving extjs. I am also
considering making my application a product for distribution but I was
thinking along the lines of an install script for macs that would set
up the apache webserver. I also like your approach.
BTW, I haven't done it, but couldn't you just store an object in zodb
that has a pointer to your video on the filesystem and access the
video via a zope product? But maybe that is what LocalFS does, I
haven't checked.
see ya in the extjs forum. Just do a search for "zope"
Tim
On 1/2/08, Matt Hollingsworth wrote:
> Yep! I have had very good luck with it so far; my little hack that I posted
> works like a (klutzy) charm and ExtJS is great with zope. The ExtJS folks
> are very well organized, and the library is quite powerful. It's working
> great. However, my application doesn't have quite the segregation that
> yours does; ExtJS and zope (DTML in particular) are much more intermingled,
> and can't be easily separated. This application is actually a frontend for
> a Java library that controls instruments at CERN (a research lab I work
> for), and I love the solution that it has presented. It works like a charm.
> (in case you're curious, it makes use of a wonderful python library I ran
> across called JPype (http://jpype.sourceforge.net) to execute the Java code)
>
> I am going to be accessing Zope through apache with the VHM, but there are
> multiple reasons why I don't want to serve the js through apache. This same
> principle is the reason that I don't want to upload things through FTP or
> WebDAV. I'm making a product, and I would like to keep it atomic, i.e., I
> want the only install procedure to be "copy product folder to
> instance/Products". Uploading via WebDAV, or hosting the javascript using
> separate software, defeats that purpose.
>
> The solution that Tom proposed (LocalFS) seems to be what I want, but the
> problem is that I think it is way too out of date; it crashed my zope server
> (2.10.5) when I installed it. It says nothing can be found after I add an
> instance through the ZMI, and this is after I fixed a deprecated import (
> from OFS.content_types import find_binary -> from zope.app.content_types
> import find binary). I had to completely remove the product to get my Zope
> instance to work again.
>
> I'm getting the feeling that there isn't really a (recent) canned solution
> for accessing file system content, which is... strange at best, considering
> all the power that zope has at its disposal. You would think that accessing
> the file system would be present just because it is so simple to do. I'm
> not complaining, as I'm *very* happy with zope, I'm just surprised :). I
> realize that zope's principle is to store everything in the database, but
> this is unacceptable for content such as video files, right? I mean the
> ZODB file would be absolutely humongous (and slow? I don't know for sure
> how it's implemented).
>
> If there isn't already a working solution, I would be happy to come up with
> one; I could just hack out the parts of LocalFS that work, add a few
> features, and repackage it into a new product. It's not difficult to do (my
> little trivial solution already would work fine if I did a non-dumb
> implementation of the file-serving logic), and as much as I would like to
> use it for other projects, it would be worth my time. For example, I want
> to make a little video/music server as a personal project unrelated to my
> current one, and I really don't want to store things in the ZODB if I can
> help it... 1 video = +1 gig ZODB? :S
>
> I don't know much about zope obviously, so if I get some vehement objections
> to this route, I'll pick another :)
>
> Thanks!
>
> -Matt
>
> -----Original Message-----
> From: Tim Nash [mailto:thedagdae@gmail.com]
> Sent: Wednesday, January 02, 2008 2:03 PM
> To: Tom Von Lahndorff
> Cc: Matt Hollingsworth; zope@zope.org
> Subject: Re: [Zope] Best Practice for including Javascript in Zope
> Applications
>
> I am writing an application that uses extjs as the front end and zope
> on the back and they work together really well.
> I am using a webserver to server the extjs library and everything else
> comes out of zope. So far I have had no trouble with relative links
> or files broken up in different locations. It may be because I have
> fully committed to having an extjs front end. I typically serve a page
> out of zope, it calls the extjs library as well as custom JavaScript
> files. The web2.0 style page then makes multiple xhr calls back to
> zope to load smaller html and json fragments. Works like a charm and
> has the additional benefit of letting me cache the majority of the
> front end in the webserver and in the users browser.
>
> Have fun because you have just come across a wonderful
> combination...extjs and zope!
> Tim
>
>
> On Jan 2, 2008 6:38 AM, Tom Von Lahndorff wrote:
> >
> > On Jan 1, 2008, at 7:20 PM, Matt Hollingsworth wrote:
> >
> > > Hello,
> > >
> > > I'm new to developing for zope, and I have a quick question
> > > regarding some best practices when using Javascript in zope
> > > applications.
> > >
> > > I would like to use Ext JS (http://www.extjs.com/ ) in an
> > > application that I am writing. It is a fairly extensive library, so
> > > I didn't really want to copy/paste every single file into a dtml
> > > method. I looked all over the place for some discussion on this
> > > subject, but only found things relating to plone (which apparently
> > > has a javascript registry); however, I wish to stay away from plone
> > > for this particular application.
> > >
> > > What should I do to use these libraries? Is there a canned solution
> > > for this sort of thing?
> > >
> > > Thank you much!
> > >
> > > -Matt
> > > _______________________________________________
> > > 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 )
> >
> >
> > You can ftp the files to a "static" directory on the file system and
> > use LocalFS to access them.
> >
> http://wiki.zope.org/zope2/LocalFS__________________________________________
> _____
> >
> > 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 )
> >
>
>
From garito at sistes.net Thu Jan 3 13:08:41 2008
From: garito at sistes.net (Garito)
Date: Thu Jan 3 13:08:44 2008
Subject: [Zope] Re: Ask for collaboration
In-Reply-To:
References:
<477CD370.3020501@palladion.com>
Message-ID:
Sorry, Tres, for the private (the stupid gmail reply)
I resend the message to the list (sorry again!)
2008/1/3, Garito :
>
>
>
> 2008/1/3, Tres Seaver :
> >
> >
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Garito wrote:
> > > Hi!
> > > I plan to create a product I call Zope Smart Manager that consist in a
> > view
> > > similar to freemind for Zope
> > > You could see a picture of my prototype here:
> > > http://blogs.sistes.net/Garito/images/ArbolYanged.png
> >
> > While I can see visual differences, how does this tree behave
> > differently than the one which the ZMI shows?
>
>
Well, it shows (or will show) not only collection objects, it shows simple
item objects and properties (the data we change normally) and it will edit
directly its values, rename objects and so on
> The idea is create a series of monkey patches to all the products we are
> > > interested to see as tree nodes and a series of javascript (prototype
> > +
> > > scriptaculous) for the "client side"
> > >
> > > I plan this ZSM view will be my main work view with edition and
> > creation
> > >
> > > For that I need some help about how to create the simplest monkey
> > patch and
> > > the javascript objects
> >
> > I don't know why you think you need to moneky-patch anything: you
> > should be able to create such a view using the standard API supplied by
> > pretty much every existing Zope object. The ZMI tree code is here:
> >
> > $ZOPE_HOME/lib/python/TreeDisplay/TreeTag.py
>
>
I would like to create a very generic javascript objects useful even with
other servers not only Zope
> I have no experience with monkey patching zope nor javascript object but
> > > I'll learn all the necessary skills if no one wants to help
> > >
> > > Can you help me at any point?
> >
> >
> >
> > Tres.
> > - --
> > ===================================================================
> > Tres Seaver +1 540-429-0999 tseaver@palladion.com
> > Palladion Software "Excellence by Design" http://palladion.com
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.6 (GNU/Linux)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQFHfNNw+gerLs4ltQ4RAqsAAJ0dpeS4NH7xRt6sH4fMHHcBnxcawQCfR4Mr
> > jEC5oHCat7/3EBgnalVVdFc=
> > =OaJS
> > -----END PGP SIGNATURE-----
> >
> >
>
>
> --
> Mis Cosas
> http://blogs.sistes.net/Garito
>
--
Mis Cosas
http://blogs.sistes.net/Garito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080103/9786f092/attachment.htm
From dieter at handshake.de Thu Jan 3 13:26:42 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Thu Jan 3 13:26:52 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
Message-ID: <18301.10466.938339.960372@gargle.gargle.HOWL>
Victor Subervi wrote at 2008-1-2 14:44 -0400:
> ...
>
>
>
>
>
As Andreas already has pointed out, you probably need "getQuote()"
rather than "getQuote" (as the name suggests, it is a method not a
value).
>
"?var" in a path expression means: replace "?var" by the value of "var".
Therefore, if "num" contains the right value, the above should work.
--
Dieter
From mr.hworth at gmail.com Fri Jan 4 04:17:05 2008
From: mr.hworth at gmail.com (Matt Hollingsworth)
Date: Fri Jan 4 04:17:02 2008
Subject: [Zope] Best Practice for including Javascript in Zope Applications
In-Reply-To: <75c632a00801030938p41b75c57qff9104040b226d55@mail.gmail.com>
Message-ID: <000301c84eb2$9449d130$960ea8c0@home.msh>
Hello,
Ok, I came up with a solution that I like; today I spent a little while
making it so I don't have to load things into memory before they are served.
Now it works quite nicely for serving out js/css/gui pics. I won't post
what I did right now, as I haven't really cleaned it up and I'm ashamed of
how it looks at the moment, but I'll post the usage of it to see if anyone
would like to use it after I clean it up:
...
from util import FileSystemResource #it's just in a utility module for my
current project at the moment
...
MyZopeObject(Implicit,Item,Whatever):
#"js" and "css" are paths that are considered relative to my package
directory (not the cwd for zope). It can be absolute too, if desired.
js = FileSystemResource("js","Javascript Repository")
css = FileSystemResource("css","CSS Repository")
Now, say that there is ext-all.js in a directory called
"/path/to/zope/Products/MyProduct/js/". You could then link to the java
script file by going to http://domain.com:8080/myZopeObject/js/ext-all.js.
In particular, in dtml, I have a standard_html_header that looks something
like this:
==standard_html_header.dtml==
This is a title.
==!End standard_html_header.dtml==
Then in MyZopeObject, I wrap up my DTML in a method like so:
.....
_main = DTMLFile("dtml/main",globals())
def main(self):
main_js=["ext-all.js","main.js"]
return _main(self.REQUEST,local_js = main_js)
I did the whole local_js thing so I could control what JS got dropped into
what pages without having to write a different header for each one. I will
probably also do the same thing for the css just in case I want
page-specific css files.
This is what I'm doing at the moment, and it's working great. If this would
be useful to someone else, I'll give it more than an hour and a half of
thought, rewrite it more intelligently, and make it available. Otherwise,
thanks to everyone for their comments!
-Matt
-----Original Message-----
From: Tim Nash [mailto:thedagdae@gmail.com]
Sent: Thursday, January 03, 2008 12:38 PM
To: Matt Hollingsworth
Cc: zope@zope.org
Subject: Re: [Zope] Best Practice for including Javascript in Zope
Applications
Matt,
Please keep us updated on your strategy for serving extjs. I am also
considering making my application a product for distribution but I was
thinking along the lines of an install script for macs that would set
up the apache webserver. I also like your approach.
BTW, I haven't done it, but couldn't you just store an object in zodb
that has a pointer to your video on the filesystem and access the
video via a zope product? But maybe that is what LocalFS does, I
haven't checked.
see ya in the extjs forum. Just do a search for "zope"
Tim
On 1/2/08, Matt Hollingsworth wrote:
> Yep! I have had very good luck with it so far; my little hack that I
posted
> works like a (klutzy) charm and ExtJS is great with zope. The ExtJS folks
> are very well organized, and the library is quite powerful. It's working
> great. However, my application doesn't have quite the segregation that
> yours does; ExtJS and zope (DTML in particular) are much more
intermingled,
> and can't be easily separated. This application is actually a frontend
for
> a Java library that controls instruments at CERN (a research lab I work
> for), and I love the solution that it has presented. It works like a
charm.
> (in case you're curious, it makes use of a wonderful python library I ran
> across called JPype (http://jpype.sourceforge.net) to execute the Java
code)
>
> I am going to be accessing Zope through apache with the VHM, but there are
> multiple reasons why I don't want to serve the js through apache. This
same
> principle is the reason that I don't want to upload things through FTP or
> WebDAV. I'm making a product, and I would like to keep it atomic, i.e., I
> want the only install procedure to be "copy product folder to
> instance/Products". Uploading via WebDAV, or hosting the javascript using
> separate software, defeats that purpose.
>
> The solution that Tom proposed (LocalFS) seems to be what I want, but the
> problem is that I think it is way too out of date; it crashed my zope
server
> (2.10.5) when I installed it. It says nothing can be found after I add an
> instance through the ZMI, and this is after I fixed a deprecated import (
> from OFS.content_types import find_binary -> from zope.app.content_types
> import find binary). I had to completely remove the product to get my
Zope
> instance to work again.
>
> I'm getting the feeling that there isn't really a (recent) canned solution
> for accessing file system content, which is... strange at best,
considering
> all the power that zope has at its disposal. You would think that
accessing
> the file system would be present just because it is so simple to do. I'm
> not complaining, as I'm *very* happy with zope, I'm just surprised :). I
> realize that zope's principle is to store everything in the database, but
> this is unacceptable for content such as video files, right? I mean the
> ZODB file would be absolutely humongous (and slow? I don't know for sure
> how it's implemented).
>
> If there isn't already a working solution, I would be happy to come up
with
> one; I could just hack out the parts of LocalFS that work, add a few
> features, and repackage it into a new product. It's not difficult to do
(my
> little trivial solution already would work fine if I did a non-dumb
> implementation of the file-serving logic), and as much as I would like to
> use it for other projects, it would be worth my time. For example, I want
> to make a little video/music server as a personal project unrelated to my
> current one, and I really don't want to store things in the ZODB if I can
> help it... 1 video = +1 gig ZODB? :S
>
> I don't know much about zope obviously, so if I get some vehement
objections
> to this route, I'll pick another :)
>
> Thanks!
>
> -Matt
>
> -----Original Message-----
> From: Tim Nash [mailto:thedagdae@gmail.com]
> Sent: Wednesday, January 02, 2008 2:03 PM
> To: Tom Von Lahndorff
> Cc: Matt Hollingsworth; zope@zope.org
> Subject: Re: [Zope] Best Practice for including Javascript in Zope
> Applications
>
> I am writing an application that uses extjs as the front end and zope
> on the back and they work together really well.
> I am using a webserver to server the extjs library and everything else
> comes out of zope. So far I have had no trouble with relative links
> or files broken up in different locations. It may be because I have
> fully committed to having an extjs front end. I typically serve a page
> out of zope, it calls the extjs library as well as custom JavaScript
> files. The web2.0 style page then makes multiple xhr calls back to
> zope to load smaller html and json fragments. Works like a charm and
> has the additional benefit of letting me cache the majority of the
> front end in the webserver and in the users browser.
>
> Have fun because you have just come across a wonderful
> combination...extjs and zope!
> Tim
>
>
> On Jan 2, 2008 6:38 AM, Tom Von Lahndorff wrote:
> >
> > On Jan 1, 2008, at 7:20 PM, Matt Hollingsworth wrote:
> >
> > > Hello,
> > >
> > > I'm new to developing for zope, and I have a quick question
> > > regarding some best practices when using Javascript in zope
> > > applications.
> > >
> > > I would like to use Ext JS (http://www.extjs.com/ ) in an
> > > application that I am writing. It is a fairly extensive library, so
> > > I didn't really want to copy/paste every single file into a dtml
> > > method. I looked all over the place for some discussion on this
> > > subject, but only found things relating to plone (which apparently
> > > has a javascript registry); however, I wish to stay away from plone
> > > for this particular application.
> > >
> > > What should I do to use these libraries? Is there a canned solution
> > > for this sort of thing?
> > >
> > > Thank you much!
> > >
> > > -Matt
> > > _______________________________________________
> > > 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 )
> >
> >
> > You can ftp the files to a "static" directory on the file system and
> > use LocalFS to access them.
> >
>
http://wiki.zope.org/zope2/LocalFS__________________________________________
> _____
> >
> > 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 )
> >
>
>
From victorsubervi at gmail.com Fri Jan 4 09:59:25 2008
From: victorsubervi at gmail.com (Victor Subervi)
Date: Fri Jan 4 09:59:27 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <18301.10466.938339.960372@gargle.gargle.HOWL>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
<18301.10466.938339.960372@gargle.gargle.HOWL>
Message-ID: <4dc0cfea0801040659r5b7232cdw1d74da78f373c6b2@mail.gmail.com>
Thank you both. However, it still doesn't work :( I have replaced "getQuote"
with "getQuote()", but to no avail. Other ideas?
*Error Type: RuntimeError
Error Value: external method could not be called because it is None*
*TIA,*
*Victor*
On Jan 3, 2008 2:26 PM, Dieter Maurer wrote:
> Victor Subervi wrote at 2008-1-2 14:44 -0400:
> > ...
> >
> >
> >
> >
> >
>
> As Andreas already has pointed out, you probably need "getQuote()"
> rather than "getQuote" (as the name suggests, it is a method not a
> value).
>
> >
>
> "?var" in a path expression means: replace "?var" by the value of "var".
>
> Therefore, if "num" contains the right value, the above should work.
>
>
>
> --
> Dieter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080104/417c6a62/attachment.htm
From David.Bear at asu.edu Fri Jan 4 17:34:05 2008
From: David.Bear at asu.edu (David Bear)
Date: Fri Jan 4 17:34:12 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
Message-ID: <20080104223405.GB25141@asu.edu>
On Wed, Jan 02, 2008 at 02:44:24PM -0400, Victor Subervi wrote:
> Hi;
> I have this in a page template:
>
>
>
>
>
>
>
> Now, I thought that was the correct way to call the variable "num" (that is,
> with the question mark: "?num"). Apparently, I'm mistaken. I've even tried
> defining it this way:
I didn't see a followup on this post, so I thought I would add my
ignorance to the discussion.
first, I don't think you can assign a variable name to a python
function using tal and then have tal 'call' the function.
second, I think what you do want is the get the results of calling
getQuote into the variable called 'num', and then use those results
elsewhere.
I think tal variables can all be first class python objects. If not,
any standard python object works -- in other words, a list, tupple,
string, dictionary, etc. If you have your own object, it will need to
have an iterator method defined for it -- but then, I wouldn't know
how to make the new class known to zope.
>
>
> to make sure that num was properly assigned. What am I missing? Also, if I
> have a dir called "scripts" in which "getQuote" exists, and "scirpts" is in
> the path, shouldn't that notation work okay?
acquisition will find many things. What does getQuote return though?
> TIA,
> Victor
> _______________________________________________
> 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 )
--
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"
From dieter at handshake.de Sat Jan 5 14:11:47 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Sat Jan 5 14:11:56 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <4dc0cfea0801040659r5b7232cdw1d74da78f373c6b2@mail.gmail.com>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
<18301.10466.938339.960372@gargle.gargle.HOWL>
<4dc0cfea0801040659r5b7232cdw1d74da78f373c6b2@mail.gmail.com>
Message-ID: <18303.54899.108244.840649@gargle.gargle.HOWL>
Victor Subervi wrote at 2008-1-4 10:59 -0400:
>Thank you both. However, it still doesn't work :( I have replaced "getQuote"
>with "getQuote()", but to no avail. Other ideas?
>*Error Type: RuntimeError
>Error Value: external method could not be called because it is None*
You see here how important it is to always provide full problem
description. Usually, beside "Error Type" and "Error Value" the
traceback, too, is very important.
The error information above tells you that your problem is
not the "?num" but your "External Method".
Unfortunately, the information is not very precise.
You need the following background information:
When an "External Method" cannot be loaded (e.g. because
its source is not found), then it is represented as "None".
You get more information, when you visit the "External Method"
in the ZMI and press "edit".
--
Dieter
From victorsubervi at gmail.com Sat Jan 5 16:17:32 2008
From: victorsubervi at gmail.com (Victor Subervi)
Date: Sat Jan 5 16:17:34 2008
Subject: [Zope] Defining a Variable
In-Reply-To: <18303.54899.108244.840649@gargle.gargle.HOWL>
References: <4dc0cfea0801021044q491f8709g1cf20c8698518be8@mail.gmail.com>
<18301.10466.938339.960372@gargle.gargle.HOWL>
<4dc0cfea0801040659r5b7232cdw1d74da78f373c6b2@mail.gmail.com>
<18303.54899.108244.840649@gargle.gargle.HOWL>
Message-ID: <4dc0cfea0801051317qcd8810drfec05b1a554b71fb@mail.gmail.com>
That was too wierd. I deleted the External Varible, then re-added it, and
all worked well! Now, I just built this new server and transfered over the
Data.fs files. Maybe that was the problem??
Thanks,
Victor
On Jan 5, 2008 3:11 PM, Dieter Maurer wrote:
> Victor Subervi wrote at 2008-1-4 10:59 -0400:
> >Thank you both. However, it still doesn't work :( I have replaced
> "getQuote"
> >with "getQuote()", but to no avail. Other ideas?
> >*Error Type: RuntimeError
> >Error Value: external method could not be called because it is None*
>
> You see here how important it is to always provide full problem
> description. Usually, beside "Error Type" and "Error Value" the
> traceback, too, is very important.
>
> The error information above tells you that your problem is
> not the "?num" but your "External Method".
>
> Unfortunately, the information is not very precise.
> You need the following background information:
>
> When an "External Method" cannot be loaded (e.g. because
> its source is not found), then it is represented as "None".
>
> You get more information, when you visit the "External Method"
> in the ZMI and press "edit".
>
>
>
> --
> Dieter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080105/1bb6e4c7/attachment.htm
From jens at dataflake.org Sun Jan 6 07:07:52 2008
From: jens at dataflake.org (Jens Vagelpohl)
Date: Sun Jan 6 07:07:57 2008
Subject: [Zope] CMF 2.1.1 released
Message-ID: <51EEF1F6-6C76-4004-8FEF-82405E0913DE@dataflake.org>
The CMF developer community is hereby announcing the release of CMF
version 2.1.1.
What is the CMF?
The Zope Content Management Framework provides a set of services and
content objects useful for building highly dynamic, content-oriented
portal sites. The CMF provides the foundation for popular software
packages such as Plone. It is intended to be easily customizable, in
terms of both the types of content used and the policies and services
it provides.
Where do I get it?
For release files, change logs, installation instructions and more
please visit http://www.zope.org/Products/CMF/CMF-2.1.1.
Roadmap and release information can be found at
http://www.zope.org/Products/CMF/docs/roadmap.
The CMF mailing list can be reached at the zope-cmf@zope.org address,
to sign up please visit http://mail.zope.org/mailman/listinfo/zope-cmf
.
Please file bug reports, feature requests or suggestions in the CMF
bug collector at https://bugs.launchpad.net/zope-cmf/ .
What has changed since the last release?
Bug Fixes
- CMFDefault.PropertiesTool: Fix a faulty manage_changeProperties
invocation which broke the 'Reconfigure Portal' screen
(https://bugs.launchpad.net/zope-cmf/+bug/174246)
- CMFCore.exportimport.content: Add simple guard against import
failures when
the ".objects" file contains empty lines.
(https://bugs.launchpad.net/zope-cmf/+bug/176328)
From dchelimsky at gmail.com Mon Jan 7 09:00:27 2008
From: dchelimsky at gmail.com (David Chelimsky)
Date: Mon Jan 7 09:00:29 2008
Subject: [Zope] Intercept request
Message-ID: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
Hi,
I want to show different things to different viewers based on their IP
addresses. How can I do this?
Cheers,
David
From lists at zopyx.com Mon Jan 7 09:06:32 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 09:06:44 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
Message-ID:
--On 7. Januar 2008 08:00:27 -0600 David Chelimsky
wrote:
> Hi,
>
> I want to show different things to different viewers based on their IP
> addresses. How can I do this?
Basically you look at the clients ip address (from the REQUEST object)
and perform any action you need (redirections, conditions within scripts,
templates)...but no idea what the sense of this usecase is. If you have
different audiences, setup sites with different content or something
similar. In addition: using Zope behind proxy will lead in request coming
from the IP address of your reverse proxy. Additional
configuration/programming is necessary to get hold of the original IP.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/c74396ff/attachment.bin
From dchelimsky at gmail.com Mon Jan 7 09:18:14 2008
From: dchelimsky at gmail.com (David Chelimsky)
Date: Mon Jan 7 09:18:16 2008
Subject: [Zope] Intercept request
In-Reply-To:
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
Message-ID: <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky
> wrote:
>
> > Hi,
> >
> > I want to show different things to different viewers based on their IP
> > addresses. How can I do this?
>
>
> Basically you look at the clients ip address (from the REQUEST object)
> and perform any action you need (redirections, conditions within scripts,
> templates)...but no idea what the sense of this usecase is. If you have
> different audiences, setup sites with different content or something
> similar. In addition: using Zope behind proxy will lead in request coming
> from the IP address of your reverse proxy. Additional
> configuration/programming is necessary to get hold of the original IP.
Thanks for the reply.
The use case is that my client wants to block a range of IP addresses
from being able to view their site. So I need to access the
originating IP address and filter appropriately.
I've written a few custom zope products before, but I've not done
anything that really modifies zope's behaviour on every request - just
on requests for the specific objects I'm publishing. So I'm familiar
with the request object, but I don't know how to intercept *every*
request. Are there any global request life-cycle hooks? If you can
point me to those that would be a great help.
Cheers,
David
From tom at modscape.com Mon Jan 7 09:22:51 2008
From: tom at modscape.com (Tom Von Lahndorff)
Date: Mon Jan 7 09:22:53 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
Message-ID:
On Jan 7, 2008, at 9:00 AM, David Chelimsky wrote:
> Hi,
>
> I want to show different things to different viewers based on their IP
> addresses. How can I do this?
>
> Cheers,
> David
swap out "theipaddress" with the actual IP.
true
true
false
Tom
>
> _______________________________________________
> 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 )
From lists at zopyx.com Mon Jan 7 09:23:06 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 09:23:19 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
Message-ID: <2E06409373BB6B2C5FBBE373@[192.168.0.24]>
--On 7. Januar 2008 08:18:14 -0600 David Chelimsky
wrote:
> On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
>> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky
>> wrote:
>>
>> > Hi,
>> >
>> > I want to show different things to different viewers based on their IP
>> > addresses. How can I do this?
>>
>>
>> Basically you look at the clients ip address (from the REQUEST object)
>> and perform any action you need (redirections, conditions within scripts,
>> templates)...but no idea what the sense of this usecase is. If you have
>> different audiences, setup sites with different content or something
>> similar. In addition: using Zope behind proxy will lead in request coming
>> from the IP address of your reverse proxy. Additional
>> configuration/programming is necessary to get hold of the original IP.
>
> Thanks for the reply.
>
> The use case is that my client wants to block a range of IP addresses
> from being able to view their site.
You have a firewall for this purpose or you use apache rewrite rules for
performing URL rewriting.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/cbaec604/attachment.bin
From tom at modscape.com Mon Jan 7 09:28:52 2008
From: tom at modscape.com (Tom Von Lahndorff)
Date: Mon Jan 7 09:28:52 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
Message-ID:
On Jan 7, 2008, at 9:18 AM, David Chelimsky wrote:
> On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
>> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky > >
>> wrote:
>>
>>> Hi,
>>>
>>> I want to show different things to different viewers based on
>>> their IP
>>> addresses. How can I do this?
>>
>>
>> Basically you look at the clients ip address (from the REQUEST
>> object)
>> and perform any action you need (redirections, conditions within
>> scripts,
>> templates)...but no idea what the sense of this usecase is. If you
>> have
>> different audiences, setup sites with different content or something
>> similar. In addition: using Zope behind proxy will lead in request
>> coming
>> from the IP address of your reverse proxy. Additional
>> configuration/programming is necessary to get hold of the original
>> IP.
>
> Thanks for the reply.
>
> The use case is that my client wants to block a range of IP addresses
> from being able to view their site. So I need to access the
> originating IP address and filter appropriately.
>
> I've written a few custom zope products before, but I've not done
> anything that really modifies zope's behaviour on every request - just
> on requests for the specific objects I'm publishing. So I'm familiar
> with the request object, but I don't know how to intercept *every*
> request. Are there any global request life-cycle hooks? If you can
> point me to those that would be a great help.
>
> Cheers,
> David
If you just need to redirect traffic from an IP range, and not do
anything fancy, it may be better to do it in Apache rather than Zope.
http://wiki.zope.org/zope2/ZopeAndApache
Tom
>
> _______________________________________________
> 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 )
From dchelimsky at gmail.com Mon Jan 7 09:35:50 2008
From: dchelimsky at gmail.com (David Chelimsky)
Date: Mon Jan 7 09:35:53 2008
Subject: [Zope] Intercept request
In-Reply-To: <2E06409373BB6B2C5FBBE373@192.168.0.24>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
Message-ID: <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
On Jan 7, 2008 8:23 AM, Andreas Jung wrote:
>
>
> --On 7. Januar 2008 08:18:14 -0600 David Chelimsky
> wrote:
>
> > On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
> >> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky
> >> wrote:
> >>
> >> > Hi,
> >> >
> >> > I want to show different things to different viewers based on their IP
> >> > addresses. How can I do this?
> >>
> >>
> >> Basically you look at the clients ip address (from the REQUEST object)
> >> and perform any action you need (redirections, conditions within scripts,
> >> templates)...but no idea what the sense of this usecase is. If you have
> >> different audiences, setup sites with different content or something
> >> similar. In addition: using Zope behind proxy will lead in request coming
> >> from the IP address of your reverse proxy. Additional
> >> configuration/programming is necessary to get hold of the original IP.
> >
> > Thanks for the reply.
> >
> > The use case is that my client wants to block a range of IP addresses
> > from being able to view their site.
>
> You have a firewall for this purpose or you use apache rewrite rules for
> performing URL rewriting.
Our host uses nginx, not apache. We can still do this w/ nginx
configuration, but it means maintaining a configuration file rather
than application code (which in my experience is more
flexible/maintainable). Right now I'm just exploring options, so I'd
still like to know how I can do this with Zope.
Thanks,
David
>
> -aj
>
>
From dchelimsky at gmail.com Mon Jan 7 09:39:40 2008
From: dchelimsky at gmail.com (David Chelimsky)
Date: Mon Jan 7 09:39:43 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
Message-ID: <57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
On Jan 7, 2008 8:35 AM, David Chelimsky wrote:
>
> On Jan 7, 2008 8:23 AM, Andreas Jung wrote:
> >
> >
> > --On 7. Januar 2008 08:18:14 -0600 David Chelimsky
> > wrote:
> >
> > > On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
> > >> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky
> > >> wrote:
> > >>
> > >> > Hi,
> > >> >
> > >> > I want to show different things to different viewers based on their IP
> > >> > addresses. How can I do this?
> > >>
> > >>
> > >> Basically you look at the clients ip address (from the REQUEST object)
> > >> and perform any action you need (redirections, conditions within scripts,
> > >> templates)...but no idea what the sense of this usecase is. If you have
> > >> different audiences, setup sites with different content or something
> > >> similar. In addition: using Zope behind proxy will lead in request coming
> > >> from the IP address of your reverse proxy. Additional
> > >> configuration/programming is necessary to get hold of the original IP.
> > >
> > > Thanks for the reply.
> > >
> > > The use case is that my client wants to block a range of IP addresses
> > > from being able to view their site.
> >
> > You have a firewall for this purpose or you use apache rewrite rules for
> > performing URL rewriting.
>
> Our host uses nginx, not apache. We can still do this w/ nginx
> configuration, but it means maintaining a configuration file rather
> than application code (which in my experience is more
> flexible/maintainable). Right now I'm just exploring options, so I'd
> still like to know how I can do this with Zope.
BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
simple script that I include on every page, yes? That could work, but
seems a bit error prone - that's why I'm looking for some sort of
request hook. But maybe that's my best option within Zope. Thoughts?
>
> Thanks,
> David
>
> >
> > -aj
> >
> >
>
From lists at zopyx.com Mon Jan 7 09:41:33 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 09:41:45 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
Message-ID: <4D0BE5A9F076CF342ECEBEAC@[192.168.0.24]>
--On 7. Januar 2008 08:35:50 -0600 David Chelimsky
wrote:
> On Jan 7, 2008 8:23 AM, Andreas Jung wrote:
>>
>>
>> --On 7. Januar 2008 08:18:14 -0600 David Chelimsky
>> wrote:
>>
>> > On Jan 7, 2008 8:06 AM, Andreas Jung wrote:
>> >> --On 7. Januar 2008 08:00:27 -0600 David Chelimsky
>> >> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > I want to show different things to different viewers based on their
>> >> > IP addresses. How can I do this?
>> >>
>> >>
>> >> Basically you look at the clients ip address (from the REQUEST object)
>> >> and perform any action you need (redirections, conditions within
>> >> scripts, templates)...but no idea what the sense of this usecase is.
>> >> If you have different audiences, setup sites with different content
>> >> or something similar. In addition: using Zope behind proxy will lead
>> >> in request coming from the IP address of your reverse proxy.
>> >> Additional
>> >> configuration/programming is necessary to get hold of the original IP.
>> >
>> > Thanks for the reply.
>> >
>> > The use case is that my client wants to block a range of IP addresses
>> > from being able to view their site.
>>
>> You have a firewall for this purpose or you use apache rewrite rules for
>> performing URL rewriting.
>
> Our host uses nginx, not apache. We can still do this w/ nginx
> configuration, but it means maintaining a configuration file rather
> than application code (which in my experience is more
> flexible/maintainable).
This issue is a configuration and not an application issue. So it basically
does not belong into Zope.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/6e39f8e9/attachment.bin
From akm at theinternet.com.au Mon Jan 7 09:49:21 2008
From: akm at theinternet.com.au (Andrew Milton)
Date: Mon Jan 7 09:50:11 2008
Subject: [Zope] Intercept request
In-Reply-To: <4D0BE5A9F076CF342ECEBEAC@[192.168.0.24]>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<4D0BE5A9F076CF342ECEBEAC@[192.168.0.24]>
Message-ID: <20080107144921.GS47620@camelot.theinternet.com.au>
+-------[ Andreas Jung ]----------------------
|
| This issue is a configuration and not an application issue. So it basically
| does not belong into Zope.
That's a pretty narrow view in my opinion. We nearly all already display
different content to different classes of user, I fail to see how grouping
those users by IP address is really any different.
--
Andrew Milton
akm@theinternet.com.au
From lists at zopyx.com Mon Jan 7 10:04:30 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 10:04:45 2008
Subject: [Zope] Intercept request
In-Reply-To: <20080107144921.GS47620@camelot.theinternet.com.au>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<4D0BE5A9F076CF342ECEBEAC@[192.168.0.24]>
<20080107144921.GS47620@camelot.theinternet.com.au>
Message-ID:
--On 8. Januar 2008 01:49:21 +1100 Andrew Milton
wrote:
> +-------[ Andreas Jung ]----------------------
>|
>| This issue is a configuration and not an application issue. So it
>| basically does not belong into Zope.
>
> That's a pretty narrow view in my opinion. We nearly all already display
> different content to different classes of user, I fail to see how
> grouping those users by IP address is really any different.
>
Narrow or not..it does not belong into directly in Zope in my opinion. If
you were using Plone for example as CMS, you could create your PAS plugin
providing dedicated roles for different IP ranges (or something similar)
and control the visibility of content through the standard Zope security by
granting View permission (and others) to the related roles.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/61a56a88/attachment.bin
From jmeile at hotmail.com Mon Jan 7 10:09:22 2008
From: jmeile at hotmail.com (Josef Meile)
Date: Mon Jan 7 10:09:18 2008
Subject: [Zope] Re: Intercept request
In-Reply-To: <57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com> <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com> <2E06409373BB6B2C5FBBE373@192.168.0.24> <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
Message-ID: <478240A2.2040906@hotmail.com>
> BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
> simple script that I include on every page, yes? That could work, but
> seems a bit error prone - that's why I'm looking for some sort of
> request hook. But maybe that's my best option within Zope. Thoughts?
I guess if you want to do this easily inside zope, then a script is the
way to go. Somebody already posted a dtml solution; however, I think it
is better you put it in a python script that will be called from your
standard_header file, which can be either a dtml method or a page
template.
A request hook will require you to patch zope, write a monkey patch, or
some kind of UserFolder based on ip addresses, which means to directly
modify zope's code or create an external product. The invested time on
doing this isn't worth, when you can do it easier and in less time, with
either a script or by modifying your proxy's configuration.
I think it would be better to let your proxy do this. This isn't really
hard with nginx:
http://wiki.codemongers.com/NginxHttpAccessModule
Anyway, if you don't have access to the maschine hosting your zope, then
you should try the script solution.
Best regards
Josef
From r.ritz at biologie.hu-berlin.de Mon Jan 7 10:16:16 2008
From: r.ritz at biologie.hu-berlin.de (Raphael Ritz)
Date: Mon Jan 7 10:16:23 2008
Subject: [Zope] Re: Intercept request
In-Reply-To: <57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com> <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com> <2E06409373BB6B2C5FBBE373@192.168.0.24> <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
Message-ID:
David Chelimsky wrote:
>
[..]
> BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
> simple script that I include on every page, yes? That could work, but
> seems a bit error prone - that's why I'm looking for some sort of
> request hook. But maybe that's my best option within Zope. Thoughts?
>
Are you saying you want an access rule?
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZopeServices.stx
Raphael
From jmeile at hotmail.com Mon Jan 7 10:28:39 2008
From: jmeile at hotmail.com (Josef Meile)
Date: Mon Jan 7 10:28:34 2008
Subject: [Zope] Re: Intercept request
In-Reply-To:
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com> <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com> <2E06409373BB6B2C5FBBE373@192.168.0.24> <57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com> <57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
Message-ID: <47824527.5060902@hotmail.com>
Raphael Ritz schrieb:
> David Chelimsky wrote:
>>
> [..]
>
>> BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
>> simple script that I include on every page, yes? That could work, but
>> seems a bit error prone - that's why I'm looking for some sort of
>> request hook. But maybe that's my best option within Zope. Thoughts?
>>
>
> Are you saying you want an access rule?
>
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZopeServices.stx
Well, I guess that would be much easier than the script solution I
mentioned before. You can put your access rule, which is also a script,
on the folder you want to restrict. You have to be careful with this
rules since you can block your access to the site; however, this
can be easily undone.
From peter at fry-it.com Mon Jan 7 13:29:50 2008
From: peter at fry-it.com (Peter Bengtsson)
Date: Mon Jan 7 12:29:24 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
Message-ID: <47826F9E.4040800@fry-it.com>
My code works fine in normal running zope but not when run as a testcase
(I'm not using bin/zopectl test if that matters) I get the following error.
I feel guilty since I've got this line in my code:
transaction.get().commit() (Expense.py#4458)
I remember having come across this error before but can't remember what
the solution was.
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/peterbe/zope/zope285/lib/python/Testing/ZopeTestCase/profiler.py",
line 98, in __call__
testMethod()
File "testExpenses2.py", line 81, in test_uploadPhotos
eids = context.uploadExpenseFiles(files)
File "/home/peterbe/zope/zope285/Products/MExpenses/Expense.py", line
4458, in uploadExpenseFiles
transaction.get().commit()
File "lib/python/transaction/_transaction.py", line 381, in commit
File "lib/python/transaction/_transaction.py", line 379, in commit
File "lib/python/transaction/_transaction.py", line 424, in
_commitResources
File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
462, in commit
self._commit(transaction)
File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
503, in _commit
self._store_objects(ObjectWriter(obj), transaction)
File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
525, in _store_objects
p = writer.serialize(obj) # This calls __getstate__ of obj
File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
330, in serialize
return self._dump(meta, obj.__getstate__())
File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
339, in _dump
self._p.dump(state)
File "copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle instancemethod objects
----------------------------------------------------------------------
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
From lists at zopyx.com Mon Jan 7 13:03:20 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 13:03:30 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
In-Reply-To: <47826F9E.4040800@fry-it.com>
References: <47826F9E.4040800@fry-it.com>
Message-ID: <3BE3CA968D7660D6B782AF02@[192.168.0.24]>
--On 7. Januar 2008 18:29:50 +0000 Peter Bengtsson wrote:
> My code works fine in normal running zope but not when run as a testcase
> (I'm not using bin/zopectl test if that matters) I get the following
> error.
> I feel guilty since I've got this line in my code:
> transaction.get().commit() (Expense.py#4458)
>
> I remember having come across this error before but can't remember what
> the solution was.
>
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/home/peterbe/zope/zope285/lib/python/Testing/ZopeTestCase/profiler.py",
> line 98, in __call__
> testMethod()
> File "testExpenses2.py", line 81, in test_uploadPhotos
> eids = context.uploadExpenseFiles(files)
> File "/home/peterbe/zope/zope285/Products/MExpenses/Expense.py", line
> 4458, in uploadExpenseFiles
> transaction.get().commit()
> File "lib/python/transaction/_transaction.py", line 381, in commit
> File "lib/python/transaction/_transaction.py", line 379, in commit
> File "lib/python/transaction/_transaction.py", line 424, in
> _commitResources
> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
> 462, in commit
> self._commit(transaction)
> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
> 503, in _commit
> self._store_objects(ObjectWriter(obj), transaction)
> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
> 525, in _store_objects
> p = writer.serialize(obj) # This calls __getstate__ of obj
> File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
> 330, in serialize
> return self._dump(meta, obj.__getstate__())
> File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
> 339, in _dump
> self._p.dump(state)
> File "copy_reg.py", line 69, in _reduce_ex
> raise TypeError, "can't pickle %s objects" % base.__name__
> TypeError: can't pickle instancemethod objects
Well, this error is self-speaking :-)
The standard solution for figuring out the related property/attr keeping
the instancemethod is: pdb. Look at the object or its __dict__ and check
what is
inside or think about your code where you might be assigning a method
somewhere.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/7dc7ee17/attachment.bin
From peter at fry-it.com Mon Jan 7 14:17:06 2008
From: peter at fry-it.com (Peter Bengtsson)
Date: Mon Jan 7 13:16:42 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
In-Reply-To: <3BE3CA968D7660D6B782AF02@[192.168.0.24]>
References: <47826F9E.4040800@fry-it.com>
<3BE3CA968D7660D6B782AF02@[192.168.0.24]>
Message-ID: <47827AB2.7030803@fry-it.com>
Andreas Jung wrote:
>
>
> --On 7. Januar 2008 18:29:50 +0000 Peter Bengtsson
> wrote:
>
>> My code works fine in normal running zope but not when run as a testcase
>> (I'm not using bin/zopectl test if that matters) I get the following
>> error.
>> I feel guilty since I've got this line in my code:
>> transaction.get().commit() (Expense.py#4458)
>>
>> I remember having come across this error before but can't remember what
>> the solution was.
>>
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> File
>> "/home/peterbe/zope/zope285/lib/python/Testing/ZopeTestCase/profiler.py",
>> line 98, in __call__
>> testMethod()
>> File "testExpenses2.py", line 81, in test_uploadPhotos
>> eids = context.uploadExpenseFiles(files)
>> File "/home/peterbe/zope/zope285/Products/MExpenses/Expense.py", line
>> 4458, in uploadExpenseFiles
>> transaction.get().commit()
>> File "lib/python/transaction/_transaction.py", line 381, in commit
>> File "lib/python/transaction/_transaction.py", line 379, in commit
>> File "lib/python/transaction/_transaction.py", line 424, in
>> _commitResources
>> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
>> 462, in commit
>> self._commit(transaction)
>> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
>> 503, in _commit
>> self._store_objects(ObjectWriter(obj), transaction)
>> File "/home/peterbe/zope/zope285/lib/python/ZODB/Connection.py", line
>> 525, in _store_objects
>> p = writer.serialize(obj) # This calls __getstate__ of obj
>> File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
>> 330, in serialize
>> return self._dump(meta, obj.__getstate__())
>> File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
>> 339, in _dump
>> self._p.dump(state)
>> File "copy_reg.py", line 69, in _reduce_ex
>> raise TypeError, "can't pickle %s objects" % base.__name__
>> TypeError: can't pickle instancemethod objects
>
> Well, this error is self-speaking :-)
>
> The standard solution for figuring out the related property/attr keeping
> the instancemethod is: pdb. Look at the object or its __dict__ and check
> what is
> inside or think about your code where you might be assigning a method
> somewhere.
>
Damn it! Not the answer I was hoping for. I was hoping for something
simpler and more obvious :)
What object do you suggest I inspect in the debugger then? I don't know
how the ZODB figures out what it needs to save.
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
From dieter at handshake.de Mon Jan 7 13:27:50 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Mon Jan 7 13:28:05 2008
Subject: [Zope] Intercept request
In-Reply-To:
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<4D0BE5A9F076CF342ECEBEAC@[192.168.0.24]>
<20080107144921.GS47620@camelot.theinternet.com.au>
Message-ID: <18306.28454.842563.939281@gargle.gargle.HOWL>
Andreas Jung wrote at 2008-1-7 16:04 +0100:
> ....
>Narrow or not..it does not belong into directly in Zope in my opinion. If
>you were using Plone for example as CMS, you could create your PAS plugin
>providing dedicated roles for different IP ranges (or something similar)
>and control the visibility of content through the standard Zope security by
>granting View permission (and others) to the related roles.
And this solution is possible in Zope, too (after "PluggableAuthService")
has been installed).
And of course, this solution is in Zope (and not the web server
or the firewall).
--
Dieter
From dieter at handshake.de Mon Jan 7 13:29:26 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Mon Jan 7 13:29:37 2008
Subject: [Zope] Re: Intercept request
In-Reply-To:
References: <57c63afe0801070600l8ca512fy42e4198450b52b68@mail.gmail.com>
<57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
<2E06409373BB6B2C5FBBE373@192.168.0.24>
<57c63afe0801070635j7d69eb1fy28fdb50b610daabd@mail.gmail.com>
<57c63afe0801070639s428a445bib9b9cea86f12559b@mail.gmail.com>
Message-ID: <18306.28550.841041.985728@gargle.gargle.HOWL>
Raphael Ritz wrote at 2008-1-7 16:16 +0100:
>David Chelimsky wrote:
>>
>[..]
>
>> BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
>> simple script that I include on every page, yes? That could work, but
>> seems a bit error prone - that's why I'm looking for some sort of
>> request hook. But maybe that's my best option within Zope. Thoughts?
>>
>
>Are you saying you want an access rule?
>
>http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZopeServices.stx
When "SiteAccess AccessRules" are used for security critical demands
then one has to keep in mind that they can be disabled via special
segments in the url.
In such a case, I would remove the code that makes this possible.
--
Dieter
From lists at zopyx.com Mon Jan 7 13:48:35 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 13:48:46 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
In-Reply-To: <47827AB2.7030803@fry-it.com>
References: <47826F9E.4040800@fry-it.com>
<3BE3CA968D7660D6B782AF02@[192.168.0.24]> <47827AB2.7030803@fry-it.com>
Message-ID:
--On 7. Januar 2008 19:17:06 +0000 Peter Bengtsson wrote:
> Damn it! Not the answer I was hoping for. I was hoping for something
> simpler and more obvious :)
>
> What object do you suggest I inspect in the debugger then? I don't know
> how the ZODB figures out what it needs to save.
>
>
That's trivial start your debugger in ZODB.serialize._dump() and check
the 'state' parameter (should be a dict). Using pprint.pprint(state) will
make the output less painful...just check the output for something with
instancemethod or something similar smelly.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080107/b35ffc97/attachment.bin
From running.clam at gmail.com Mon Jan 7 16:10:32 2008
From: running.clam at gmail.com (Running Clam)
Date: Mon Jan 7 16:10:34 2008
Subject: [Zope] Using md5 with allow_module
Message-ID:
Hi,
I have a need to generate an md5 hash for an XML fragment generated by
TTW Zope code.
I thought I could do this with "allow_module" - I have a
pseudo-product with an __init_,py that contains: -
# Global module assertions for Python scripts
from Products.PythonScripts.Utility import allow_module
allow_module("md5")
In my TTW python script, I have: -
import md5
hash=md5.new()
hash=hash.update('test')
...but when I execute the script I get: -
Error Type: Unauthorized
Error Value: The container has no security assertions. Access to
'update' of (md5.md5 object at 0xb98ab00) denied.
I'm basing this on: -
http://www.zope.org/Documentation/Books/ZDG/current/Security.stx
...specifically the section entitled " Utility Functions For Allowing
Import of Modules By Through The Web Code".
I thought I understood this, and have used it with other Python
modules, but based on what is happening with the md5 module, I
obvioulsy don't!
Can someone clue me in, or point me towards more recent or explicit
documentation, please?
--
Cheers,
Philip
From lists at zopyx.com Mon Jan 7 23:55:04 2008
From: lists at zopyx.com (Andreas Jung)
Date: Mon Jan 7 23:55:17 2008
Subject: [Zope] Using md5 with allow_module
In-Reply-To:
References:
Message-ID: <208F4C090E5AF8835A6BE356@[192.168.0.24]>
--On 7. Januar 2008 21:10:32 +0000 Running Clam
wrote:
> Hi,
>
> I have a need to generate an md5 hash for an XML fragment generated by
> TTW Zope code.
> >
> Error Type: Unauthorized
> Error Value: The container has no security assertions. Access to
> 'update' of (md5.md5 object at 0xb98ab00) denied.
>
> I'm basing this on: -
>
> http://www.zope.org/Documentation/Books/ZDG/current/Security.stx
>
> ...specifically the section entitled " Utility Functions For Allowing
> Import of Modules By Through The Web Code".
>
> I thought I understood this, and have used it with other Python
> modules, but based on what is happening with the md5 module, I
> obvioulsy don't!
>
>
FAQ!
allow_module() does not work with all and everything.
Use an external method or a browser view instead or move your code into
your zope product code (if you have one).
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080108/6fe7c8d6/attachment.bin
From running.clam at gmail.com Tue Jan 8 01:47:37 2008
From: running.clam at gmail.com (Running Clam)
Date: Tue Jan 8 01:47:39 2008
Subject: [Zope] Using md5 with allow_module
In-Reply-To:
References:
<208F4C090E5AF8835A6BE356@192.168.0.24>
Message-ID:
Hi All,
Sorry Andreas - I hit "reply" instead of "reply-all", and sent my
response only to you.
Thanks for your reply.
On 1/8/08, Andreas Jung wrote:
>
> FAQ!
>
Yes, there have been a good few questions about this - I spent a lot
of time googling yesterday, and found a couple of threads where the
questioner seems to have given up at this point.
The problem seems to be that it works "some of the time" - I have
another case where it works (pywintypes, FWIW).
> allow_module() does not work with all and everything.
> Use an external method or a browser view instead or move your code into
> your zope product code (if you have one).
>
In this case, how could I know that allow_module() will not work with
md5? IOW, how could I tell the difference between a module not being a
candidate for allow_module() and an error in my own code?
I understand that an external method or a product are my other
choices, but I'm really uncomfortable about not understanding how I
can tell when I can and when I cannot use allow_module() - at the
moment, this feels horribly like "trial and error" coding!
Enough people have struggled with this that I'd like to understand it
well enough to add something to the wiki for the next person who has
the problem...
--
Cheers,
Philip
From lists at zopyx.com Tue Jan 8 02:06:53 2008
From: lists at zopyx.com (Andreas Jung)
Date: Tue Jan 8 02:07:07 2008
Subject: [Zope] Using md5 with allow_module
In-Reply-To:
References:
<208F4C090E5AF8835A6BE356@192.168.0.24>
Message-ID: <095534C89815AB47BE7FB037@[192.168.0.24]>
--On 8. Januar 2008 06:47:37 +0000 Running Clam
wrote:
> I understand that an external method or a product are my other
> choices, but I'm really uncomfortable about not understanding how I
> can tell when I can and when I cannot use allow_module() - at the
> moment, this feels horribly like "trial and error" coding!
>
> Enough people have struggled with this that I'd like to understand it
> well enough to add something to the wiki for the next person who has
> the problem...
There is an intriguing comment at the end of the page:
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080108/1292907e/attachment.bin
From zopelist at betabug.ch Tue Jan 8 03:10:00 2008
From: zopelist at betabug.ch (Sascha Welter)
Date: Tue Jan 8 03:10:04 2008
Subject: [Zope] Intercept request
In-Reply-To: <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
References: <57c63afe0801070618v39077a88ve65916ee1727c049@mail.gmail.com>
Message-ID: <20080108081000.GA15448@betabug.ch>
(Mon, Jan 07, 2008 at 08:18:14AM -0600) David Chelimsky wrote/schrieb/egrapse:
> The use case is that my client wants to block a range of IP addresses
> from being able to view their site. So I need to access the
> originating IP address and filter appropriately.
You might also want to look at http://betabug.ch/wiki/HoneyPotBL
which is a module that accesses the projecthoneypot.org HTTP blacklist
database. The actual code to block access is not in this module (as I
believe it's application specific), but anyway it might be interesting.
Regards,
Sascha
From running.clam at gmail.com Tue Jan 8 03:27:08 2008
From: running.clam at gmail.com (Running Clam)
Date: Tue Jan 8 03:27:11 2008
Subject: [Zope] Using md5 with allow_module
In-Reply-To: <095534C89815AB47BE7FB037@192.168.0.24>
References:
<208F4C090E5AF8835A6BE356@192.168.0.24>
<095534C89815AB47BE7FB037@192.168.0.24>
Message-ID:
Hi Andreas,
On 1/8/08, Andreas Jung wrote:
> > Enough people have struggled with this that I'd like to understand it
> > well enough to add something to the wiki for the next person who has
> > the problem...
>
> There is an intriguing comment at the end of the page:
>
>
>
Yes, I saw that.
I've been in this situation a couple of times before, and have not
pursued the "allow_modules()" option because it was simple enough to
create an external method. However, this "seemed" like a nice simple
case where allow_modules() "should" work, so I wanted to get to the
bottom of it and understand my previous problems.
>From what you say, the most useful comment I could add to the wiki
would be to quote your original response that "allow_module() does not
work with all and everything" and add my own conclusion that if
allow_module() does not work in a given case it is not worth spending
much troubleshooting time on.
I'm happy to accept your advice that allow_modules() simply won't work
in all cases - but that's the advice I wish I'd found in the wiki 24
hours ago...
--
Cheers,
Philip
From candyshop999 at gmail.com Tue Jan 8 05:12:59 2008
From: candyshop999 at gmail.com (Super Star)
Date: Tue Jan 8 05:13:01 2008
Subject: [Zope] Liberty League International,
Signs Of A Real Internet Home Business
Message-ID:
Liberty League International, Signs Of A Real Internet Home Business
The world of internet home business is often clouded by people trying to
scam opportunity seekers. This can make for a very disheartening and
difficult process of finding a real home business opportunity.
Part of the problem is that there are so many choices in home business
opportunities. The internet has made home business something almost anyone
can, no matter their budget. This also has created the perfect breeding
ground for those who love to offer big promises but fail to deliver.
In order to find a real internet home business opportunity a person has to
understand how to spot a real opportunity from a scam. This may sometimes be
tricky, but it can be done when a person has the right knowledge.
One of the key differences between a real home business opportunity and a
scam is that with a real opportunity the company is willing to tell
everything up front. They make it clear what the business is and how money
is made. They never try to hide anything or keep details vague.
Another big sign of a real opportunity is that there will be plenty of
people who are willing to back up the company. These people may be customers
or even other business owners. People who have worked or who are working for
a company are the best source of information. They will be able to give the
real scoop about if the opportunity is real or a scam.
Also look for a genuine, proven system of making money through the business.
If there is not a clear way that money will be made then it is not likely to
be a real home business opportunity.
Finding a real home business opportunity is something that can be despite
the many scams that seem to about there. There are plenty of real home
business opportunities that can make a big profit and be successful. It is
just all about weeding the real one from the scams.
www.libertyleagueinternational.info
www.libertyleagueconference.com
www.beyondfreedom.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080108/7474a545/attachment.htm
From candyshop999 at gmail.com Tue Jan 8 05:35:14 2008
From: candyshop999 at gmail.com (Super Star)
Date: Tue Jan 8 05:35:15 2008
Subject: [Zope] Five Point Capital,
Searching for the Right Keywords through Staff Leasing Companies
Message-ID:
Five Point Capital, Searching for the Right Keywords through Staff Leasing
Companies
A growing number of websites compete to be among the top ten listings in the
search results. This position gives them a higher possibility of getting
more customers compared with a lower rank. Web marketers use several tools
to achieve high rankings, probably one of the most important although others
don?t realize, is keyword research.
There are many tactics for optimizing a site to have high search rankings.
But since most visits to a site start with a search engine click, optimizing
a site for the right keywords is really critical. This is why keyword
research is so important, right?
It is really important that you will be able to target all relevant keyword
phrases to be able to be among the top rank websites. You just can?t afford
to guess the keywords often searched by people, or else you?ll see your
businesses slowly toppling down. Searching for the right keywords for your
websites doesn?t simply take a day or two. It would sometimes take a week or
more.
If this is so, how can busy people maintain or increase the ranks of their
websites. Yeah, maybe it can be done, but how sure that it is done
systematically and professionally? Hiring a new employee to do this can also
be costly for a company especially if it is just starting. Some resort to
webmaster staffing?
Getting someone from a webmaster staffing company to do professional keyword
research and other services can do no harm to your business; it is to your
advantage, in fact. The company wouldn?t have to provide office space for
the staff as they will be working in their own place but still under your
directions. Plus, you?re free from hiring and training costs. Staffs from
webmaster staffing companies like Agents of Value are already well-trained
and were able to pass extensive screening process to be able to provide
world-class services.
Opting to hire from a webmaster staffing company can lessen your overhead
expenses like overtime. This companies also charge lower for their services
compared to others so you will be able to save in your labor cost. Most
outsourcing offices are found in places with lower cost of living.
Keyword research may sound so easy but finding the right ones takes time and
effort. Only people who have the time, knowledge and training can do this
efficiently. If you want to get your sites on the top list, a webmaster
staffing company is the best choice for you to look for someone who?ll work
it for your business!
Annie Rose Pantas is a webmaster working for Agents of value, an
outsourcing company that offers programming, online marketing and graphic
designing services. Visit these sites and
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080108/ec3e1573/attachment.htm
From candyshop999 at gmail.com Tue Jan 8 08:09:27 2008
From: candyshop999 at gmail.com (Super Star)
Date: Tue Jan 8 08:09:29 2008
Subject: [Zope]
Wendy Stevens Nashville, So You Want To Start A Home Business
Message-ID:
Wendy Stevens Nashville Tennesee, So You Want To Start A Home Business
Wendy Stevens Franklin Tennesee
So you want to start a home business, and don't know where to begin. Like
any other business, research the company your interested in. Find out all
you can about their business practices, their creditability, what they offer
and exactly what you will be doing in this home business.
When researching a business, keep in mind these 3 red flags:
1. Introduction Material Costs Money.
This information should be free. It introduces the company, tells what they
do, what they offer, and how to sign up.
2. Promise of Getting Rich Quickly in Less Than 10 hours a Week.
Though it is possible, it isn't probable. It takes time to build a business
and clientele. You should expect to work more than 10 hours a week, and it
take awhile to build any income.
3. Limited Time Offers.
A company is making promises (especially of quick wealth), but you only have
a certain amount of time to enroll; I'd take a step back and reevaluate the
situation. Generally, these are scams.
There are reputable companies that use some of these techniques, just make
sure to do your research. My best advices is look for a business that
interests you, do the research to enable you to make the best decision
possible, have realistic expectations, and enjoy your endeavors.
About The Author
Copyright 2004 Written by Lisa Saylor Author. Lisa has a business site about
online business opportunities and articles at and has a online store and
business opportunities at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080108/241be81b/attachment.htm
From dieter at handshake.de Tue Jan 8 15:49:52 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Tue Jan 8 15:50:03 2008
Subject: [Zope] [WARNING] Nasty bug detected in "ManagableIndex"
Message-ID: <18307.57840.43009.80436@gargle.gargle.HOWL>
Today, I detected (and fixed) a nasty bug in my "ManagabelIndex".
The bug affects indexes with "TermType=='DateInteger'".
When for such an index a "DateTime" value is converted to a "DateInteger",
the input is rounded up to a "Date" rather than rounded down.
Because this is applied uniformly to all "DateTime" values,
the bug becomes visible only when true "Date" values and "DateTime"
values are both involved.
The bug is fixed in version 1.7.3 which can be found at
After "ManagableIndex" is updated, all affected indexes needs
to be reindexed (as otherwise the update makes things worse:
the indexed values have used rounding up while the queries
use rounding down).
--
Dieter
From dieter at handshake.de Tue Jan 8 17:10:53 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Tue Jan 8 17:11:01 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
In-Reply-To: <47826F9E.4040800@fry-it.com>
References: <47826F9E.4040800@fry-it.com>
Message-ID: <18307.62701.13027.900399@gargle.gargle.HOWL>
Peter Bengtsson wrote at 2008-1-7 18:29 +0000:
>My code works fine in normal running zope but not when run as a testcase
>(I'm not using bin/zopectl test if that matters) I get the following error.
>I feel guilty since I've got this line in my code:
>transaction.get().commit() (Expense.py#4458)
>
>I remember having come across this error before but can't remember what
>the solution was.
> ...
> File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
>339, in _dump
> self._p.dump(state)
> File "copy_reg.py", line 69, in _reduce_ex
> raise TypeError, "can't pickle %s objects" % base.__name__
>TypeError: can't pickle instancemethod objects
>
>----------------------------------------------------------------------
Apparently, you have an "instancemethod" in your test setup
where you do not have one in the normal Zope.
An alternative explanation could be that in your normal
Zope additional pickle registrations are performed.
If you would use, e.g., my "CompiledExecutable" product,
then the import of this product would register "code" and "instancemethod"
instances as picklable. A test setup may not import "CompiledExecutables"
and its pickle registrations would be missing.
A side note: Usually, it is a very bad idea to perform a full
"commit" in a test. Such "commit"s are incompatible with
techniques that share (for efficiency reasons) part of the
test setup among several tests. "ZopeTestCase", e.g., makes
use of such techniques.
--
Dieter
From dieter at handshake.de Tue Jan 8 17:14:35 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Tue Jan 8 17:14:42 2008
Subject: [Zope] Using md5 with allow_module
In-Reply-To:
References:
Message-ID: <18307.62923.612473.439089@gargle.gargle.HOWL>
Running Clam wrote at 2008-1-7 21:10 +0000:
>I have a need to generate an md5 hash for an XML fragment generated by
>TTW Zope code.
>
>I thought I could do this with "allow_module" - I have a
>pseudo-product with an __init_,py that contains: -
>
># Global module assertions for Python scripts
>from Products.PythonScripts.Utility import allow_module
>allow_module("md5")
An "allow_module" allows import of the module and all its content.
It does not in general allow to use the objects inside the module.
For example, to use class instances for classes defined in the module,
the class must provide its own security declarations which control
in what way the instances can be used.
In your case, the module contains special types.
You need an "allow_type" for each of these types to be able to
use them.
--
Dieter
From hamzat at dnetsystems.net Tue Jan 8 18:27:22 2008
From: hamzat at dnetsystems.net (Kamal Hamzat)
Date: Wed Jan 9 13:02:15 2008
Subject: [Zope] locked out of zope
Message-ID: <000701c852e9$c0a0f250$0200a8c0@design4>
Hi,
I am unable to log-in into the my zope server. This just happened because I have not changed my log-in info.
Afterwards I also tried to create emergency user and still unable to login.
I used the plone3_buildout to build the zope and plone. And what I noticed was that i have 2 zpasswd.py files in my installation.
one here: C:\optilux\bin\parts\zope2\utilities
and another one here :
C:\>cd optilux\bin\parts\zope2\lib\python\zope2\startup\misc
Any help will be highly appreciated.
Thanks.
Kamal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080108/ef6213ae/attachment.htm
From lists at zopyx.com Wed Jan 9 13:14:15 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 9 13:14:31 2008
Subject: [Zope] locked out of zope
In-Reply-To: <000701c852e9$c0a0f250$0200a8c0@design4>
References: <000701c852e9$c0a0f250$0200a8c0@design4>
Message-ID:
--On 8. Januar 2008 23:27:22 +0000 Kamal Hamzat
wrote:
> Hi,
>
> I am unable to log-in into the my zope server. This just happened because
> I have not changed my log-in info.
>
> Afterwards I also tried to create emergency user and still unable to
> login.
>
> I used the plone3_buildout to build the zope and plone. And what I
> noticed was that i have 2 zpasswd.py files in my installation.
>
> one here: C:\optilux\bin\parts\zope2\utilities
> and another one here :
> C:\>cd optilux\bin\parts\zope2\lib\python\zope2\startup\misc
>
You can always create a new account using
zopectl adduser username password
and login with this account.
-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080109/ee0d1f41/attachment.bin
From garito at sistes.net Thu Jan 10 06:22:34 2008
From: garito at sistes.net (Garito)
Date: Thu Jan 10 06:22:36 2008
Subject: [Zope] Zope Smart Manager
Message-ID:
Hi!
I have subscribed to this list for some years
In this time I make some questions to this list that sounds weird for
a part of you
Perhaps my english is poor, perhaps my ideas are weird but doesn't matter
If the question is that my english is poor perhaps some code will be
more clear that my words, I don't know
Now it's time to code
I would like to introduce you Zope Smart Manager, perhaps it speaks
better than me
Please feel free to check this silly idea at: http://code.google.com/p/zsm/
Note that this is a very, very early stage of the project but I would
like to show you the way I see your beautifull and amazing work
Please feel free to contribute as deep as you like but give a chance
to it (perhaps you could understand my point of view better and we
could understand us better too)
I will appreciate your visions and your opinions
I love Zope's simplicity but I aspire to do go deeper in this way: simplicity
Sorry for this days of misunderstud and thanks a lot for your help
(even when I was think you could help me more ;) )
--
Mis Cosas
http://blogs.sistes.net/Garito
From garito at sistes.net Fri Jan 11 06:33:07 2008
From: garito at sistes.net (Garito)
Date: Fri Jan 11 06:33:09 2008
Subject: [Zope] The best way
Message-ID:
Hi, all!
If you have download the ZSM product you could see I put on it a zexp
file with prototype and some other js file and a css file plus images
This was only a prototype solution to bring you the chance to see how
my ideas are but I think this is not a definitive solution
Now my question:
Which is the best zope way to serve this kind of files trying to avoid
any other product dependence?
Thanks a lot!
--
Mis Cosas
http://blogs.sistes.net/Garito
From garito at sistes.net Fri Jan 11 11:26:50 2008
From: garito at sistes.net (Garito)
Date: Fri Jan 11 11:26:52 2008
Subject: [Zope] The best way
In-Reply-To: <007b01c85466$6cb8b1e0$960ea8c0@home.msh>
References:
<007b01c85466$6cb8b1e0$960ea8c0@home.msh>
Message-ID:
Hi!
Thanks Martijn and Matt for your ideas!
@Matt: can you explain with more detail the question about
REQUEST.response.write()? If the written content is as long as a file like
prototype is not a very heavy solution?
The contents of the zexp file are only js files and images (static content)
and I'm using Zope2
What about the functionality of the freemind view? What do you think about?
Thanks!
2008/1/11, Matt Hollingsworth :
>
> Hi,
>
> This sounds like the same problem I presented earlier. Are you using zope
> 2.x? If so, then it will only take you ~30 minutes to code something that
> makes use of REQUEST.response.write(). That's what I ended up doing; I
> wrote a simple class that would mount a directory on the file system and
> just serve the files that are in that directory. If you make use of
> globals()["__file__"], you can make the class independent of absolute
> locations.
>
> If you are using zope 3 (I'm not sure if you can easily get this
> functionality out of five + zope2.x, since this deals with the
> publisher...
> someone else would have to answer that), look at this site:
>
> http://apidoc.zope.org/++apidoc++/Book/zopepublisherhttpresults.txt/show.htm
> l
>
> Basically, it appears you can just return a file reference and let the
> publisher deal with the rest.
>
> A filesystem-based solution, as opposed to a ZODB way of doing this sort
> of
> thing, seems to be the best way to go as far as I'm concerned.
>
> If you are, indeed, using zope2.x, and want to go the response.write()
> route
> look at OFS/Image.py for an example of the serving logic if you want to
> avoid putting everything in memory.
>
> There may be better ways to do this sort of thing, but at least this is
> one
> way of going about it that worked nicely for me!
>
> -Matt
>
> -----Original Message-----
> From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of
> Garito
> Sent: Friday, January 11, 2008 6:33 AM
> To: Zope user list
> Subject: [Zope] The best way
>
> Hi, all!
> If you have download the ZSM product you could see I put on it a zexp
> file with prototype and some other js file and a css file plus images
>
> This was only a prototype solution to bring you the chance to see how
> my ideas are but I think this is not a definitive solution
>
> Now my question:
>
> Which is the best zope way to serve this kind of files trying to avoid
> any other product dependence?
>
> Thanks a lot!
> --
> Mis Cosas
> http://blogs.sistes.net/Garito
> _______________________________________________
> 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 )
>
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080111/099047e1/attachment.htm
From garito at sistes.net Fri Jan 11 11:34:13 2008
From: garito at sistes.net (Garito)
Date: Fri Jan 11 11:34:15 2008
Subject: [Zope] manage_renameObjects and AJAX
Message-ID:
Hi!
I'm try to implement the edition part of ZSM and I begin with the rename
objects functionality
I create a InPlaceEditor object to rename every branch but when I submit the
form the rename command works ok but the response is the manage_main (or
similar) and the tree disappear
Is there a way to make manage_renameObjects returns the changed values?
If not I need to write another monkey_patched function, isn't it?
Thanks!
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080111/2966381e/attachment.htm
From dieter at handshake.de Fri Jan 11 13:21:09 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Fri Jan 11 13:21:18 2008
Subject: [Zope] manage_renameObjects and AJAX
In-Reply-To:
References:
Message-ID: <18311.45973.884645.914773@gargle.gargle.HOWL>
Garito wrote at 2008-1-11 17:34 +0100:
>I'm try to implement the edition part of ZSM and I begin with the rename
>objects functionality
>I create a InPlaceEditor object to rename every branch but when I submit the
>form the rename command works ok but the response is the manage_main (or
>similar) and the tree disappear
Many "manage_*" functions/methods have been designed not only to be
used as simple functions but as also part of the ZMI.
When used as ZMI functions, they must (eventually) return some HTML.
They either do this by itself returning the HTML or by redirecting
to an HTML page.
These functions often distinquish between the "normal function use"
and the "ZMI use" by looking whether "REQUEST" is passed in.
If used as a ZMI functionality, the ZPublisher will pass in "REQUEST"
automatically.
>Is there a way to make manage_renameObjects returns the changed values?
>If not I need to write another monkey_patched function, isn't it?
If you need to use these functions via the "ZPublisher",
then it is best to make a little wrapper that is "ZPublisher" called
instead and then calls the function without passing "REQUEST".
--
Dieter
From garito at sistes.net Fri Jan 11 13:55:04 2008
From: garito at sistes.net (Garito)
Date: Fri Jan 11 13:55:06 2008
Subject: [Zope] manage_renameObjects and AJAX
In-Reply-To: <18311.45973.884645.914773@gargle.gargle.HOWL>
References:
<18311.45973.884645.914773@gargle.gargle.HOWL>
Message-ID:
Ok
Then I put another function into the monkey patch to rename the objects
Did you try to install the product? I'm specially interested in the opinions
of big helpers like you
Thank you very much!
2008/1/11, Dieter Maurer :
>
> Garito wrote at 2008-1-11 17:34 +0100:
> >I'm try to implement the edition part of ZSM and I begin with the rename
> >objects functionality
> >I create a InPlaceEditor object to rename every branch but when I submit
> the
> >form the rename command works ok but the response is the manage_main (or
> >similar) and the tree disappear
>
> Many "manage_*" functions/methods have been designed not only to be
> used as simple functions but as also part of the ZMI.
> When used as ZMI functions, they must (eventually) return some HTML.
> They either do this by itself returning the HTML or by redirecting
> to an HTML page.
>
> These functions often distinquish between the "normal function use"
> and the "ZMI use" by looking whether "REQUEST" is passed in.
> If used as a ZMI functionality, the ZPublisher will pass in "REQUEST"
> automatically.
>
> >Is there a way to make manage_renameObjects returns the changed values?
> >If not I need to write another monkey_patched function, isn't it?
>
> If you need to use these functions via the "ZPublisher",
> then it is best to make a little wrapper that is "ZPublisher" called
> instead and then calls the function without passing "REQUEST".
>
>
>
> --
> Dieter
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080111/86269c85/attachment.htm
From tseaver at palladion.com Fri Jan 11 14:03:35 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Fri Jan 11 14:04:03 2008
Subject: [Zope] Re: The best way
In-Reply-To:
References:
Message-ID: <4787BD87.9080601@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Garito wrote:
> Hi, all!
> If you have download the ZSM product you could see I put on it a zexp
> file with prototype and some other js file and a css file plus images
>
> This was only a prototype solution to bring you the chance to see how
> my ideas are but I think this is not a definitive solution
>
> Now my question:
>
> Which is the best zope way to serve this kind of files trying to avoid
> any other product dependence?
>
> Thanks a lot!
In the context of Five / Zope3, the static content items are
"resources". One strategy would be to create a Zope2 product with those
files in a subdirectory, e.g.::
$ mkdir Products/garito
$ cd Products/garito
$ echo "# ZSM product" > __init__.py
$ mkdir static
$ cat > static/garito.css
body {
background: #CCCCFF;
}
^D
And then register that directory as a "resource directory" via ZCML::
$ cat > configure.zcml
^D
Now, when you start Zope2, you can pull in your static resources via
special URLs, like http://localhost:8080/++resource++garito/garito.css::
$ cd ../..
$ bin/zopectl start
. daemon process started, pid=25240
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /++resource++garito/garito.css HTTP/1.0
HTTP/1.0 200 OK
Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
Date: Fri, 11 Jan 2008 18:53:11 GMT
Content-Length: 32
Last-Modified: Fri, 11 Jan 2008 18:44:47 GMT
Connection: close
Cache-Control: public,max-age=86400
Content-Type: text/css; charset=iso-8859-15
body {
background: #CCCCFF;
}
Connection closed by foreign host.
In that product, you could also register a template / browser view which
includes your resources, e.g::
$ cd Products/garito
$ cat > garito.pt
Garito's view
^D
$ cat > configure.zcml
^D
$ cd ../..
$ bin/zopectl restart
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /garito.html HTTP/1.0
HTTP/1.0 200 OK
Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
Date: Fri, 11 Jan 2008 19:02:05 GMT
Content-Length: 151
Content-Type: text/html; charset=iso-8859-15
Connection: close
Garito's view
Connection closed by foreign host.
Which pulls in your static resources.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHh72H+gerLs4ltQ4RAgwwAKDSJPrGAuwo++ShjWjZzyn06IDz1QCeK69s
+CIbgsCJkbRV5Tdh9XWEY9k=
=Du8x
-----END PGP SIGNATURE-----
From garito at sistes.net Fri Jan 11 14:55:02 2008
From: garito at sistes.net (Garito)
Date: Fri Jan 11 14:55:06 2008
Subject: [Zope] Re: The best way
In-Reply-To: <4787BD87.9080601@palladion.com>
References:
<4787BD87.9080601@palladion.com>
Message-ID:
Wow! That's exactly what I need
Tomorrow I'll try this
Thank you so much Tres!!!
2008/1/11, Tres Seaver :
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Garito wrote:
> > Hi, all!
> > If you have download the ZSM product you could see I put on it a zexp
> > file with prototype and some other js file and a css file plus images
> >
> > This was only a prototype solution to bring you the chance to see how
> > my ideas are but I think this is not a definitive solution
> >
> > Now my question:
> >
> > Which is the best zope way to serve this kind of files trying to avoid
> > any other product dependence?
> >
> > Thanks a lot!
>
> In the context of Five / Zope3, the static content items are
> "resources". One strategy would be to create a Zope2 product with those
> files in a subdirectory, e.g.::
>
> $ mkdir Products/garito
> $ cd Products/garito
> $ echo "# ZSM product" > __init__.py
> $ mkdir static
> $ cat > static/garito.css
> body {
> background: #CCCCFF;
> }
> ^D
>
> And then register that directory as a "resource directory" via ZCML::
>
> $ cat > configure.zcml
>
> name="garito"
> directory="static"
> />
>
> ^D
>
> Now, when you start Zope2, you can pull in your static resources via
> special URLs, like http://localhost:8080/++resource++garito/garito.css::
>
> $ cd ../..
> $ bin/zopectl start
> . daemon process started, pid=25240
> $ telnet localhost 8080
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /++resource++garito/garito.css HTTP/1.0
>
> HTTP/1.0 200 OK
> Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
> Date: Fri, 11 Jan 2008 18:53:11 GMT
> Content-Length: 32
> Last-Modified: Fri, 11 Jan 2008 18:44:47 GMT
> Connection: close
> Cache-Control: public,max-age=86400
> Content-Type: text/css; charset=iso-8859-15
>
> body {
> background: #CCCCFF;
> }
> Connection closed by foreign host.
>
> In that product, you could also register a template / browser view which
> includes your resources, e.g::
>
> $ cd Products/garito
> $ cat > garito.pt
>
>
> href="/++resource++garito/garito.css"/>
>
>
>
>
>
> Connection closed by foreign host.
>
> Which pulls in your static resources.
>
>
>
> Tres.
> - --
> ===================================================================
> Tres Seaver +1 540-429-0999 tseaver@palladion.com
> Palladion Software "Excellence by Design" http://palladion.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHh72H+gerLs4ltQ4RAgwwAKDSJPrGAuwo++ShjWjZzyn06IDz1QCeK69s
> +CIbgsCJkbRV5Tdh9XWEY9k=
> =Du8x
> -----END 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 )
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080111/a4677625/attachment.htm
From mr.hworth at gmail.com Fri Jan 11 20:20:16 2008
From: mr.hworth at gmail.com (Matt Hollingsworth)
Date: Fri Jan 11 20:20:37 2008
Subject: [Zope] Re: The best way
In-Reply-To: <4787BD87.9080601@palladion.com>
Message-ID: <009d01c854b9$4afbad70$960ea8c0@home.msh>
Thanks! That solves my problem as well :).
-Matt
-----Original Message-----
From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Tres
Seaver
Sent: Friday, January 11, 2008 2:04 PM
To: zope@zope.org
Subject: [Zope] Re: The best way
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Garito wrote:
> Hi, all!
> If you have download the ZSM product you could see I put on it a zexp
> file with prototype and some other js file and a css file plus images
>
> This was only a prototype solution to bring you the chance to see how
> my ideas are but I think this is not a definitive solution
>
> Now my question:
>
> Which is the best zope way to serve this kind of files trying to avoid
> any other product dependence?
>
> Thanks a lot!
In the context of Five / Zope3, the static content items are
"resources". One strategy would be to create a Zope2 product with those
files in a subdirectory, e.g.::
$ mkdir Products/garito
$ cd Products/garito
$ echo "# ZSM product" > __init__.py
$ mkdir static
$ cat > static/garito.css
body {
background: #CCCCFF;
}
^D
And then register that directory as a "resource directory" via ZCML::
$ cat > configure.zcml
^D
Now, when you start Zope2, you can pull in your static resources via
special URLs, like http://localhost:8080/++resource++garito/garito.css::
$ cd ../..
$ bin/zopectl start
. daemon process started, pid=25240
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /++resource++garito/garito.css HTTP/1.0
HTTP/1.0 200 OK
Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
Date: Fri, 11 Jan 2008 18:53:11 GMT
Content-Length: 32
Last-Modified: Fri, 11 Jan 2008 18:44:47 GMT
Connection: close
Cache-Control: public,max-age=86400
Content-Type: text/css; charset=iso-8859-15
body {
background: #CCCCFF;
}
Connection closed by foreign host.
In that product, you could also register a template / browser view which
includes your resources, e.g::
$ cd Products/garito
$ cat > garito.pt
Garito's view
^D
$ cat > configure.zcml
^D
$ cd ../..
$ bin/zopectl restart
$ telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /garito.html HTTP/1.0
HTTP/1.0 200 OK
Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
Date: Fri, 11 Jan 2008 19:02:05 GMT
Content-Length: 151
Content-Type: text/html; charset=iso-8859-15
Connection: close
Garito's view
Connection closed by foreign host.
Which pulls in your static resources.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHh72H+gerLs4ltQ4RAgwwAKDSJPrGAuwo++ShjWjZzyn06IDz1QCeK69s
+CIbgsCJkbRV5Tdh9XWEY9k=
=Du8x
-----END 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 )
From peter at fry-it.com Sun Jan 13 07:20:23 2008
From: peter at fry-it.com (Peter Bengtsson)
Date: Sun Jan 13 07:20:26 2008
Subject: [Zope] "can't pickle instancemethod objects" in testcase
In-Reply-To: <18307.62701.13027.900399@gargle.gargle.HOWL>
References: <47826F9E.4040800@fry-it.com>
<18307.62701.13027.900399@gargle.gargle.HOWL>
Message-ID:
Thanks Andreas and Dieter,
The explanation was quite simple, I set an attribute on an object that
was a method like this::
class TestBase(ZopeTestCase.ZopeTestCase):
def dummy_redirect(self, *a, **kw):
self.has_redirected = a[0]
if kw:
print "*** Redirecting to %r + (%s)" % (a[0], kw)
else:
print "*** Redirecting to %r" % a[0]
def afterSetUp(self):
self._setupDBConnection()
dispatcher = self.folder.manage_addProduct['MExpenses']
dispatcher.manage_addHomepage('mexpenses')
self.mexpenses = self.folder['mexpenses']
self.mexpenses.http_redirect = self.dummy_redirect # NOTICE!!
request = self.app.REQUEST
sdm = self.app.session_data_manager
request.set('SESSION', sdm.getSessionData())
self.has_redirected = False
The reason for the dummy redirector is boring. The reason for the
transaction.get().commit() is to not cancel everything when a
ConflicrError happens during a very long-lasting file upload.
Again, thanks.
PS. Andreas, I did use your set_trace() tip on the ZODB code. Isn't
Python great!
On 08/01/2008, Dieter Maurer wrote:
> Peter Bengtsson wrote at 2008-1-7 18:29 +0000:
> >My code works fine in normal running zope but not when run as a testcase
> >(I'm not using bin/zopectl test if that matters) I get the following error.
> >I feel guilty since I've got this line in my code:
> >transaction.get().commit() (Expense.py#4458)
> >
> >I remember having come across this error before but can't remember what
> >the solution was.
> > ...
> > File "/home/peterbe/zope/zope285/lib/python/ZODB/serialize.py", line
> >339, in _dump
> > self._p.dump(state)
> > File "copy_reg.py", line 69, in _reduce_ex
> > raise TypeError, "can't pickle %s objects" % base.__name__
> >TypeError: can't pickle instancemethod objects
> >
> >----------------------------------------------------------------------
>
> Apparently, you have an "instancemethod" in your test setup
> where you do not have one in the normal Zope.
>
> An alternative explanation could be that in your normal
> Zope additional pickle registrations are performed.
> If you would use, e.g., my "CompiledExecutable" product,
> then the import of this product would register "code" and "instancemethod"
> instances as picklable. A test setup may not import "CompiledExecutables"
> and its pickle registrations would be missing.
>
>
> A side note: Usually, it is a very bad idea to perform a full
> "commit" in a test. Such "commit"s are incompatible with
> techniques that share (for efficiency reasons) part of the
> test setup among several tests. "ZopeTestCase", e.g., makes
> use of such techniques.
>
>
>
> --
> Dieter
>
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
From dieter at handshake.de Sun Jan 13 07:41:21 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Sun Jan 13 07:41:31 2008
Subject: [Zope] manage_renameObjects and AJAX
In-Reply-To:
References:
<18311.45973.884645.914773@gargle.gargle.HOWL>
Message-ID: <18314.1777.754290.73108@gargle.gargle.HOWL>
Garito wrote at 2008-1-11 19:55 +0100:
> ...
>Did you try to install the product?
I try only products the description of which clearly indicates that
I need them.
You decided to let your code speak -- but this has no chance with me :-)
--
Dieter
From garito at sistes.net Sun Jan 13 08:01:01 2008
From: garito at sistes.net (Garito)
Date: Sun Jan 13 08:01:05 2008
Subject: [Zope] manage_renameObjects and AJAX
In-Reply-To: <18314.1777.754290.73108@gargle.gargle.HOWL>
References:
<18311.45973.884645.914773@gargle.gargle.HOWL>
<18314.1777.754290.73108@gargle.gargle.HOWL>
Message-ID:
What a pity!
Doesn't matter but is a lost chance to understand the other
If some time you would like to evaluate it I will thank you
Thanks!
2008/1/13, Dieter Maurer :
>
> Garito wrote at 2008-1-11 19:55 +0100:
> > ...
> >Did you try to install the product?
>
> I try only products the description of which clearly indicates that
> I need them.
>
> You decided to let your code speak -- but this has no chance with me :-)
>
>
>
> --
> Dieter
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080113/11d94ec4/attachment.htm
From m.van.rees at zestsoftware.nl Sun Jan 13 18:32:42 2008
From: m.van.rees at zestsoftware.nl (Maurits van Rees)
Date: Sun Jan 13 18:32:53 2008
Subject: [Zope] NamedTemplate.__call__ not returning anything
Message-ID:
Hi,
I have some code where I try to get a named template and render it and
if it fails I render a default template instead. But this fails,
presumably because the __call__ method of NamedTemplate does not
return anything. From zope/formlib/namedtemplate.py (Zope 2.10):
class NamedTemplate(object):
def __init__(self, name):
self.__name__ = name
def __get__(self, instance, type=None):
if instance is None:
return self
return component.getAdapter(instance, INamedTemplate, self.__name__)
def __call__(self, instance, *args, **kw):
self.__get__(instance)(*args, **kw)
I seems strange to me that __call__ does not actually return
anything. Is it just me?
Now, I have some other code where NamedTemplate is working just fine,
so there is probably nothing wrong with this __call__ method. So can
anybody tell me what is wrong with my following code then?
class Renderer(base.Renderer):
default_template = ViewPageTemplateFile('vocabularyportlet.pt')
def render(self):
"""Render a named template or the default template.
"""
template = NamedTemplate("test.vocabulary")
try:
output = template(self)
except ComponentLookupError:
output = None
# Even if the component lookup works, output can be None.
if output is None:
output = self.default_template()
return output
The line "output = template(self)" fails with a ComponentLookupError
unless a named template with the name test.vocabulary exists. But
when that template is found, output is still None.
In case you want to see the entire code, this is in a Plone portlet
that I am developing:
http://svn.plone.org/svn/collective/collective.portlet.vocabulary/trunk/collective/portlet/vocabulary
And actually, the tests that I added pass when I change the
NamedTemplate.__call__ method to return the value that it just got.
So should that method be changed or is there a different way to do this?
Thanks,
--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]
From armtuk at gmail.com Sun Jan 13 23:56:07 2008
From: armtuk at gmail.com (Alex Turner)
Date: Mon Jan 14 07:34:38 2008
Subject: [Zope] Problem with buildout
Message-ID: <33c6269f0801132056y64f405eavcda63566db5aae0e@mail.gmail.com>
I am building a plone3 site using buildout, but I've noticed that the
scripts in /parts/zope2/utilities and /parts/zope2/ZODBTools
have a different interpreter. So much so that the scripts in ZODBTools
don't work on my system because they are trying to use a python that doesn't
exist.
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080113/683567d5/attachment.htm
From garito at sistes.net Mon Jan 14 08:30:48 2008
From: garito at sistes.net (Garito)
Date: Mon Jan 14 08:30:59 2008
Subject: [Zope] Re: The best way
In-Reply-To: <4787BD87.9080601@palladion.com>
References:
<4787BD87.9080601@palladion.com>
Message-ID:
It works like a champ!
Absolutely THANKS! This is the help we need
2008/1/11, Tres Seaver :
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Garito wrote:
> > Hi, all!
> > If you have download the ZSM product you could see I put on it a zexp
> > file with prototype and some other js file and a css file plus images
> >
> > This was only a prototype solution to bring you the chance to see how
> > my ideas are but I think this is not a definitive solution
> >
> > Now my question:
> >
> > Which is the best zope way to serve this kind of files trying to avoid
> > any other product dependence?
> >
> > Thanks a lot!
>
> In the context of Five / Zope3, the static content items are
> "resources". One strategy would be to create a Zope2 product with those
> files in a subdirectory, e.g.::
>
> $ mkdir Products/garito
> $ cd Products/garito
> $ echo "# ZSM product" > __init__.py
> $ mkdir static
> $ cat > static/garito.css
> body {
> background: #CCCCFF;
> }
> ^D
>
> And then register that directory as a "resource directory" via ZCML::
>
> $ cat > configure.zcml
>
> name="garito"
> directory="static"
> />
>
> ^D
>
> Now, when you start Zope2, you can pull in your static resources via
> special URLs, like http://localhost:8080/++resource++garito/garito.css::
>
> $ cd ../..
> $ bin/zopectl start
> . daemon process started, pid=25240
> $ telnet localhost 8080
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> GET /++resource++garito/garito.css HTTP/1.0
>
> HTTP/1.0 200 OK
> Server: Zope/(unreleased version, python 2.4.4, linux2) ZServer/1.1
> Date: Fri, 11 Jan 2008 18:53:11 GMT
> Content-Length: 32
> Last-Modified: Fri, 11 Jan 2008 18:44:47 GMT
> Connection: close
> Cache-Control: public,max-age=86400
> Content-Type: text/css; charset=iso-8859-15
>
> body {
> background: #CCCCFF;
> }
> Connection closed by foreign host.
>
> In that product, you could also register a template / browser view which
> includes your resources, e.g::
>
> $ cd Products/garito
> $ cat > garito.pt
>
>
> href="/++resource++garito/garito.css"/>
>
>
>
>
>
> Connection closed by foreign host.
>
> Which pulls in your static resources.
>
>
>
> Tres.
> - --
> ===================================================================
> Tres Seaver +1 540-429-0999 tseaver@palladion.com
> Palladion Software "Excellence by Design" http://palladion.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHh72H+gerLs4ltQ4RAgwwAKDSJPrGAuwo++ShjWjZzyn06IDz1QCeK69s
> +CIbgsCJkbRV5Tdh9XWEY9k=
> =Du8x
> -----END 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 )
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080114/1a41b426/attachment.htm
From dieter at handshake.de Mon Jan 14 13:57:57 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Mon Jan 14 13:58:05 2008
Subject: [Zope] NamedTemplate.__call__ not returning anything
In-Reply-To:
References:
Message-ID: <18315.45237.715257.544360@gargle.gargle.HOWL>
Maurits van Rees wrote at 2008-1-13 23:32 +0000:
>I have some code where I try to get a named template and render it and
>if it fails I render a default template instead. But this fails,
>presumably because the __call__ method of NamedTemplate does not
>return anything. From zope/formlib/namedtemplate.py (Zope 2.10):
>
>class NamedTemplate(object):
>
> def __init__(self, name):
> self.__name__ = name
>
> def __get__(self, instance, type=None):
> if instance is None:
> return self
> return component.getAdapter(instance, INamedTemplate, self.__name__)
>
> def __call__(self, instance, *args, **kw):
> self.__get__(instance)(*args, **kw)
>
>I seems strange to me that __call__ does not actually return
>anything. Is it just me?
It returns only if you use "return" (otherwise, it returns "None").
Thus, try "return self.__get__(....)".
--
Dieter
From dieter at handshake.de Mon Jan 14 14:00:39 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Mon Jan 14 14:00:50 2008
Subject: [Zope] Problem with buildout
In-Reply-To: <33c6269f0801132056y64f405eavcda63566db5aae0e@mail.gmail.com>
References: <33c6269f0801132056y64f405eavcda63566db5aae0e@mail.gmail.com>
Message-ID: <18315.45399.749716.585512@gargle.gargle.HOWL>
Alex Turner wrote at 2008-1-13 23:56 -0500:
>I am building a plone3 site using buildout, but I've noticed that the
>scripts in /parts/zope2/utilities and /parts/zope2/ZODBTools
>have a different interpreter. So much so that the scripts in ZODBTools
>don't work on my system because they are trying to use a python that doesn't
>exist.
I doubt that your message here will have a lot of effect.
You may file a bug report ("https://bugs.launchpad.net/zope/"),
but I am not sure that that will have much effect, either.
The problem may be too minor that anyone wants to fix it.
--
Dieter
From m.van.rees at zestsoftware.nl Mon Jan 14 16:20:12 2008
From: m.van.rees at zestsoftware.nl (Maurits van Rees)
Date: Mon Jan 14 16:20:24 2008
Subject: [Zope] Re: NamedTemplate.__call__ not returning anything
References:
<18315.45237.715257.544360@gargle.gargle.HOWL>
Message-ID:
Dieter Maurer, on 2008-01-14:
> Maurits van Rees wrote at 2008-1-13 23:32 +0000:
>>I have some code where I try to get a named template and render it and
>>if it fails I render a default template instead. But this fails,
>>presumably because the __call__ method of NamedTemplate does not
>>return anything. From zope/formlib/namedtemplate.py (Zope 2.10):
>>
>>class NamedTemplate(object):
>>
>> def __init__(self, name):
>> self.__name__ = name
>>
>> def __get__(self, instance, type=None):
>> if instance is None:
>> return self
>> return component.getAdapter(instance, INamedTemplate, self.__name__)
>>
>> def __call__(self, instance, *args, **kw):
>> self.__get__(instance)(*args, **kw)
>>
>>I seems strange to me that __call__ does not actually return
>>anything. Is it just me?
>
> It returns only if you use "return" (otherwise, it returns "None").
>
> Thus, try "return self.__get__(....)".
I know. :) I think you misunderstood me there. This class is from
core Zope (zope.formlib.namedtemplate). So to refrase my question:
why does this call method not do "return self.__get(....)"? Looks
like a bug to me, but this line has been there since 2005 and named
templates do seem to work fine, so I am confused.
--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]
From m.van.rees at zestsoftware.nl Mon Jan 14 17:21:54 2008
From: m.van.rees at zestsoftware.nl (Maurits van Rees)
Date: Mon Jan 14 17:22:06 2008
Subject: [Zope] Re: NamedTemplate.__call__ not returning anything
References:
<18315.45237.715257.544360@gargle.gargle.HOWL>
Message-ID:
Maurits van Rees, on 2008-01-14:
> Dieter Maurer, on 2008-01-14:
>> Maurits van Rees wrote at 2008-1-13 23:32 +0000:
>>>I have some code where I try to get a named template and render it and
>>>if it fails I render a default template instead. But this fails,
>>>presumably because the __call__ method of NamedTemplate does not
>>>return anything. From zope/formlib/namedtemplate.py (Zope 2.10):
>>>
>>>class NamedTemplate(object):
>>>
>>> def __init__(self, name):
>>> self.__name__ = name
>>>
>>> def __get__(self, instance, type=None):
>>> if instance is None:
>>> return self
>>> return component.getAdapter(instance, INamedTemplate, self.__name__)
>>>
>>> def __call__(self, instance, *args, **kw):
>>> self.__get__(instance)(*args, **kw)
>>>
>>>I seems strange to me that __call__ does not actually return
>>>anything. Is it just me?
>>
>> It returns only if you use "return" (otherwise, it returns "None").
>>
>> Thus, try "return self.__get__(....)".
>
> I know. :) I think you misunderstood me there. This class is from
> core Zope (zope.formlib.namedtemplate). So to refrase my question:
> why does this call method not do "return self.__get(....)"? Looks
> like a bug to me, but this line has been there since 2005 and named
> templates do seem to work fine, so I am confused.
Actually, when I remove that __call__ method from namedtemplate.py,
the zope.formlib tests still pass (and in fact all 5868 tests from
bin/test.py pass). Tested on the Zope 2.10 branch.
So I would say: either the call method should be fixed by making it
return the value it has just calculated, or it should be removed.
When I remove the call method, my own code sill throws an error, a
different one now:
AttributeError: NamedTemplateImplementation instance has no __call__ method
For a minute I thought I could work around that by directly using the
only line from the above class that I really need:
template = getAdapter(self, INamedTemplate, 'myname')
But that still throws the same AttributeError.
I must be doing something strange...
--
Maurits van Rees | http://maurits.vanrees.org/
Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]
From jurian at oco.co.za Mon Jan 14 15:03:31 2008
From: jurian at oco.co.za (Jurian Botha)
Date: Tue Jan 15 10:17:58 2008
Subject: [Zope] Zope ZMI Templates
Message-ID: <14734109.post@talk.nabble.com>
I'm currently developing some customized ZMI pages and I was hoping someone
could give me some insight into what the best way would be to do this.
I see that Zope 2 uses dtml methods to build the standard ZMI pages but as
far as I know (Zope 3 wise) I should rather be using Zope Page Templates to
build the pages.
I would also like the product to gracefully move on to Zope 3 in future, so
that should be taken into consideration as well.
Are there perhaps some existsing templates for ZMI that can also be used
with Zope 3?
--
View this message in context: http://www.nabble.com/Zope-ZMI-Templates-tp14734109p14734109.html
Sent from the Zope - General mailing list archive at Nabble.com.
From peter at fry-it.com Tue Jan 15 14:02:01 2008
From: peter at fry-it.com (Peter Bengtsson)
Date: Tue Jan 15 13:01:33 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <14734109.post@talk.nabble.com>
References: <14734109.post@talk.nabble.com>
Message-ID: <478D0329.1010004@fry-it.com>
I would strongly advice against building on top of the ZMI. It's dated
and as you say, in DTML. It's also too geeky to be acceptable by any
client of mine.
Personally I'd build something standalone that you have ultimate control
over. You can still use things like manage_renameObjects() in your own
mnagement interface; which you'd be able to replace once you move to zope 3.
Jurian Botha wrote:
> I'm currently developing some customized ZMI pages and I was hoping someone
> could give me some insight into what the best way would be to do this.
>
> I see that Zope 2 uses dtml methods to build the standard ZMI pages but as
> far as I know (Zope 3 wise) I should rather be using Zope Page Templates to
> build the pages.
>
> I would also like the product to gracefully move on to Zope 3 in future, so
> that should be taken into consideration as well.
>
> Are there perhaps some existsing templates for ZMI that can also be used
> with Zope 3?
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
From tseaver at palladion.com Tue Jan 15 14:02:10 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Tue Jan 15 14:02:26 2008
Subject: [Zope] Re: Zope ZMI Templates
In-Reply-To: <14734109.post@talk.nabble.com>
References: <14734109.post@talk.nabble.com>
Message-ID: <478D0332.8060301@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jurian Botha wrote:
> I'm currently developing some customized ZMI pages and I was hoping someone
> could give me some insight into what the best way would be to do this.
>
> I see that Zope 2 uses dtml methods to build the standard ZMI pages but as
> far as I know (Zope 3 wise) I should rather be using Zope Page Templates to
> build the pages.
>
> I would also like the product to gracefully move on to Zope 3 in future, so
> that should be taken into consideration as well.
>
> Are there perhaps some existsing templates for ZMI that can also be used
> with Zope 3?
You could choose to use a 'zmi_master' template which looked like so::
Non-boilerplate goes here.
If you registered that template as a view in your product's
'configure.zcml', e.g.:
you can then use it in your own ZMI templates, e.g.:
Test ZMI Macro
I have attached a tarball of a simple Zope2 product which does this.
After installation, you should be able to visit
http://localhost:8080/zmi_test to see the results.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHjQMy+gerLs4ltQ4RAvHpAJ4h8VuFM3M4v333UU4jB71CJgvNqgCfcnjf
YMSO8d3hiDf5eMyG31nn9Ng=
=fh+F
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zmi3.tar.gz
Type: application/gzip
Size: 809 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080115/359f07a7/zmi3.tar.bin
From garito at sistes.net Tue Jan 15 14:23:22 2008
From: garito at sistes.net (Garito)
Date: Tue Jan 15 14:23:40 2008
Subject: [Zope] Re: Zope ZMI Templates
In-Reply-To: <478D0332.8060301@palladion.com>
References: <14734109.post@talk.nabble.com> <478D0332.8060301@palladion.com>
Message-ID:
Hi again, Tres!
Can you point as where we can find this kind of help? Are there some
reference manual or similar? (I'm using Zope2) Perhaps on Five manual?
Thanks a lot!
2008/1/15, Tres Seaver :
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Jurian Botha wrote:
> > I'm currently developing some customized ZMI pages and I was hoping
> someone
> > could give me some insight into what the best way would be to do this.
> >
> > I see that Zope 2 uses dtml methods to build the standard ZMI pages but
> as
> > far as I know (Zope 3 wise) I should rather be using Zope Page Templates
> to
> > build the pages.
> >
> > I would also like the product to gracefully move on to Zope 3 in future,
> so
> > that should be taken into consideration as well.
> >
> > Are there perhaps some existsing templates for ZMI that can also be used
> > with Zope 3?
>
> You could choose to use a 'zmi_master' template which looked like so::
>
>
>
>
>
> Non-boilerplate goes here.
>
>
>
>
> If you registered that template as a view in your product's
> 'configure.zcml', e.g.:
>
> for="*"
> name="zmi_master"
> template="zmi_master.pt"
> />
>
> you can then use it in your own ZMI templates, e.g.:
>
>
>
>
>
Test ZMI Macro
>
>
>
>
> I have attached a tarball of a simple Zope2 product which does this.
> After installation, you should be able to visit
> http://localhost:8080/zmi_test to see the results.
>
>
> Tres.
> - --
> ===================================================================
> Tres Seaver +1 540-429-0999 tseaver@palladion.com
> Palladion Software "Excellence by Design" http://palladion.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHjQMy+gerLs4ltQ4RAvHpAJ4h8VuFM3M4v333UU4jB71CJgvNqgCfcnjf
> YMSO8d3hiDf5eMyG31nn9Ng=
> =fh+F
> -----END 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 )
>
>
>
--
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080115/45e4bea8/attachment.htm
From tseaver at palladion.com Tue Jan 15 15:39:30 2008
From: tseaver at palladion.com (Tres Seaver)
Date: Tue Jan 15 15:39:44 2008
Subject: [Zope] Re: Zope ZMI Templates
In-Reply-To:
References: <14734109.post@talk.nabble.com> <478D0332.8060301@palladion.com>
Message-ID: <478D1A02.9020806@palladion.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Garito wrote:
> Hi again, Tres!
> Can you point as where we can find this kind of help? Are there some
> reference manual or similar? (I'm using Zope2) Perhaps on Five manual?
I'm afraid I don't know the docs very well: I tend to use the source
when memory fails me. ;) Honestly, I typed those examples in off the
top of my head, and then created the product to test them: except for a
single typo, it Just Worked (TM).
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver@palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHjRoC+gerLs4ltQ4RAsF9AJ9g5kghDMORCsHeD6bM391MuGpLKwCg0erV
+9TiFSIzjeSwRGpz720sDGQ=
=CytP
-----END PGP SIGNATURE-----
From thedagdae at gmail.com Tue Jan 15 21:38:58 2008
From: thedagdae at gmail.com (Tim Nash)
Date: Tue Jan 15 21:39:03 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <478D0329.1010004@fry-it.com>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
Message-ID: <75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
Jurian,
While the ZMI is a bit geeky for the average user, it works quite
well inside an iframe.
iframes are used by many ajax/web2 (whatever you want to call it)
libraries. So in my application (for example) I currently make ajax
calls to load specific zmi pages inside tabs of a window layout.
I agree with Peter that you are better off building your own interface
(if you are going to expose the manage_* methods) but I personally
hope the zmi stays around for a while!
Tim
On Jan 15, 2008 11:02 AM, Peter Bengtsson wrote:
> I would strongly advice against building on top of the ZMI. It's dated
> and as you say, in DTML. It's also too geeky to be acceptable by any
> client of mine.
> Personally I'd build something standalone that you have ultimate control
> over. You can still use things like manage_renameObjects() in your own
> mnagement interface; which you'd be able to replace once you move to zope 3.
>
> Jurian Botha wrote:
> > I'm currently developing some customized ZMI pages and I was hoping someone
> > could give me some insight into what the best way would be to do this.
> >
> > I see that Zope 2 uses dtml methods to build the standard ZMI pages but as
> > far as I know (Zope 3 wise) I should rather be using Zope Page Templates to
> > build the pages.
> >
> > I would also like the product to gracefully move on to Zope 3 in future, so
> > that should be taken into consideration as well.
> >
> > Are there perhaps some existsing templates for ZMI that can also be used
> > with Zope 3?
>
> --
> Peter Bengtsson,
> work www.fry-it.com
> home www.peterbe.com
> hobby www.issuetrackerproduct.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 )
>
From David.Bear at asu.edu Tue Jan 15 22:21:44 2008
From: David.Bear at asu.edu (David Bear)
Date: Tue Jan 15 22:21:47 2008
Subject: [Zope] lambda's in external methods
Message-ID: <20080116032144.GK19750@asu.edu>
In the zope 2.7 book it mentions that an optimization technique for
external methods is to compile regular expressions in global scope to
the module. The re's will then be compiled at zope load time.
I am wondering if the same holds for lambdas. I created some simple
filters using lambdas. I defined them in the functions where I use
them. Is there any advantage to defining them globally to the module?
Are there any gottcha's with globally scope objects?
--
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"
From tino at wildenhain.de Wed Jan 16 03:33:58 2008
From: tino at wildenhain.de (Tino Wildenhain)
Date: Wed Jan 16 03:58:40 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
Message-ID: <478DC176.3000802@wildenhain.de>
Tim Nash wrote:
> Jurian,
> While the ZMI is a bit geeky for the average user, it works quite
> well inside an iframe.
> iframes are used by many ajax/web2 (whatever you want to call it)
> libraries. So in my application (for example) I currently make ajax
> calls to load specific zmi pages inside tabs of a window layout.
IFRames. You should avoid those. With ajax or similar its easy to skip
such stuff and just replace any named container tag.
Regards
Tino
From lists at zopyx.com Wed Jan 16 12:52:37 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 16 12:52:55 2008
Subject: [Zope] lambda's in external methods
In-Reply-To: <20080116032144.GK19750@asu.edu>
References: <20080116032144.GK19750@asu.edu>
Message-ID:
--On 15. Januar 2008 20:21:44 -0700 David Bear wrote:
> In the zope 2.7 book it mentions that an optimization technique for
> external methods is to compile regular expressions in global scope to
> the module.
I don't think that this is very specific to Zope but a general
recommendation for any Python application. Since compiling regexes can be
expensive you want to compile then once. Defining them on the module level
is the common solution.
>
> I am wondering if the same holds for lambdas. I created some simple
> filters using lambdas. I defined them in the functions where I use
> them. Is there any advantage to defining them globally to the module?
>
I don't see any relationship between lambda expressions and regex since
there is no compilation involved when dealing with lambda expressions -
except the byte code compiliation however this takes place when importing a
module - not at runtime.
> Are there any gottcha's with globally scope objects?
This is a general programming question - no necessarily tied to Python. A
general answer might be: define only those things globally that must be
globally (aka void global namespace polution). Usually define some
constants or something similar globally in order to avoid moving those
parameters around..but it depends on the individual usecase.
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080116/0c157bcc/attachment.bin
From lists at zopyx.com Wed Jan 16 12:54:51 2008
From: lists at zopyx.com (Andreas Jung)
Date: Wed Jan 16 12:55:01 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <478DC176.3000802@wildenhain.de>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
Message-ID: <2157EB20ECBCED46B10672C2@[192.168.0.24]>
--On 16. Januar 2008 09:33:58 +0100 Tino Wildenhain
wrote:
> Tim Nash wrote:
>> Jurian,
>> While the ZMI is a bit geeky for the average user, it works quite
>> well inside an iframe.
>> iframes are used by many ajax/web2 (whatever you want to call it)
>> libraries. So in my application (for example) I currently make ajax
>> calls to load specific zmi pages inside tabs of a window layout.
>
> IFRames. You should avoid those. With ajax or similar its easy to skip
> such stuff and just replace any named container tag.
Iframes are still a valid choice in case asynchronous won't work e.g. when
you need to load resources from servers != your origin server. Due the
security model of asynchronous requests, a browser will only load stuff
from the origin server. Iframes are a way to work around this limitation -
ugly as you said, but sometimes a good workaround.
Ansdeas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080116/2a52476d/attachment.bin
From dieter at handshake.de Wed Jan 16 13:15:06 2008
From: dieter at handshake.de (Dieter Maurer)
Date: Wed Jan 16 13:15:15 2008
Subject: [Zope] lambda's in external methods
In-Reply-To: <20080116032144.GK19750@asu.edu>
References: <20080116032144.GK19750@asu.edu>
Message-ID: <18318.18858.329132.96749@gargle.gargle.HOWL>
David Bear wrote at 2008-1-15 20:21 -0700:
>In the zope 2.7 book it mentions that an optimization technique for
>external methods is to compile regular expressions in global scope to
>the module. The re's will then be compiled at zope load time.
>
>I am wondering if the same holds for lambdas.
"lambda"s are (as well as any static Python code) compiled at
load time -- independent of their position.
When you move the "lambda" to the top level, then the "lambda" object, too,
is build at load time. Otherwise, the object is build when the
function containing the "lambda" reaches the lambda.
However, construction this object from the predefined pieces is not
very expensive.
--
Dieter
From thedagdae at gmail.com Wed Jan 16 20:05:46 2008
From: thedagdae at gmail.com (Tim Nash)
Date: Wed Jan 16 20:05:48 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <2157EB20ECBCED46B10672C2@192.168.0.24>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
<2157EB20ECBCED46B10672C2@192.168.0.24>
Message-ID: <75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
The other important difference between ajax loaded pages and iframes
is that when you click on a link within an iframe page, the returned
page is loaded into the same iframe.
If I am not being clear, please check out this png file.
http://medicinebrain.com/iframe.png
In this png I did a search for DML Docs within a tab panel and the
search results are loaded into the same tab.
BTW, I would like to simplify the zmi even more for my users. I want
to hide various tabs (eg. security, find, etc) and I want to restrict
the number of products they are shown in the drop down box for adding
to a folder.
However, I still want to offer complete zmi functionality to the
overall administrator.
I can probably hide the security tabs using css (the overall admin
won't load the css sheet) but how can I control the products displayed
to a user in the folder view of the zmi?
Thanks,
Tim
On Jan 16, 2008 9:54 AM, Andreas Jung wrote:
>
>
> --On 16. Januar 2008 09:33:58 +0100 Tino Wildenhain
> wrote:
>
>
> > Tim Nash wrote:
> >> Jurian,
> >> While the ZMI is a bit geeky for the average user, it works quite
> >> well inside an iframe.
> >> iframes are used by many ajax/web2 (whatever you want to call it)
> >> libraries. So in my application (for example) I currently make ajax
> >> calls to load specific zmi pages inside tabs of a window layout.
> >
> > IFRames. You should avoid those. With ajax or similar its easy to skip
> > such stuff and just replace any named container tag.
>
> Iframes are still a valid choice in case asynchronous won't work e.g. when
> you need to load resources from servers != your origin server. Due the
> security model of asynchronous requests, a browser will only load stuff
> from the origin server. Iframes are a way to work around this limitation -
> ugly as you said, but sometimes a good workaround.
>
> Ansdeas
From Lars.Hohmuth at ktd-kyocera.com Wed Jan 16 21:40:12 2008
From: Lars.Hohmuth at ktd-kyocera.com (Lars Hohmuth)
Date: Wed Jan 16 21:40:56 2008
Subject: [Zope] Plone middle aligns all colums
Message-ID: <9A6213D6CEDE5147A5FA6559410C363D02A4D9C5@Mail1.ktd.com>
I have a weird problem with our Plone 2.5.3 test site after a new
designer took over. Plone now middle aligns the content column and the
portlets in the slot on the center line, instead of on top.
--------------------
---------------------------
| Left-slots |
| | center
| |
---------------------------
---------------------
We can sort of fix this by manually adding vertical-align: top; in the
css. But my designer claims that he caused this by "changing a setting
in Plone or the ZMI" and doesn't remember which one.
Since it's not on the production site, it's not a life and death
situation, but any suggestions what might cause this are gratefully
accepted. Google and the Plone site search yielded pretty much nothing.
Thanks,
Lars Hohmuth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20080116/89b15f1c/attachment.htm
From lists at zopyx.com Thu Jan 17 00:35:35 2008
From: lists at zopyx.com (Andreas Jung)
Date: Thu Jan 17 00:35:45 2008
Subject: [Zope] Plone middle aligns all colums
In-Reply-To: <9A6213D6CEDE5147A5FA6559410C363D02A4D9C5@Mail1.ktd.com>
References: <9A6213D6CEDE5147A5FA6559410C363D02A4D9C5@Mail1.ktd.com>
Message-ID: <4D652E71381702DC11E4AD2C@[192.168.0.24]>
Please ask the plone-users mailing list (dedicated to Plone issues).
Andreas
--On 16. Januar 2008 18:40:12 -0800 Lars Hohmuth
wrote:
> I have a weird problem with our Plone 2.5.3 test site after a new
> designer took over. Plone now middle aligns the content column and the
> portlets in the slot on the center line, instead of on top.
>
>
>
>
>
> --------------------
>
>
>
> ---------------------------
>
>| Left-slots |
>
>| | center
>
>| |
>
> ---------------------------
>
>
>
> ---------------------
>
>
>
> We can sort of fix this by manually adding vertical-align: top; in the
> css. But my designer claims that he caused this by "changing a setting
> in Plone or the ZMI" and doesn't remember which one.
>
>
>
> Since it's not on the production site, it's not a life and death
> situation, but any suggestions what might cause this are gratefully
> accepted. Google and the Plone site search yielded pretty much nothing.
>
>
>
> Thanks,
>
> Lars Hohmuth
>
>
>
--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 T?bingen - Germany
Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Gesch?ftsf?hrer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080117/0af36b0f/attachment.bin
From tino at wildenhain.de Thu Jan 17 03:30:39 2008
From: tino at wildenhain.de (Tino Wildenhain)
Date: Thu Jan 17 03:31:00 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
<2157EB20ECBCED46B10672C2@192.168.0.24>
<75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
Message-ID: <478F122F.7080104@wildenhain.de>
Hi Tim,
Tim Nash wrote:
> The other important difference between ajax loaded pages and iframes
> is that when you click on a link within an iframe page, the returned
> page is loaded into the same iframe.
> If I am not being clear, please check out this png file.
>
> http://medicinebrain.com/iframe.png
>
> In this png I did a search for DML Docs within a tab panel and the
> search results are loaded into the same tab.
>
> BTW, I would like to simplify the zmi even more for my users. I want
> to hide various tabs (eg. security, find, etc) and I want to restrict
> the number of products they are shown in the drop down box for adding
> to a folder.
> However, I still want to offer complete zmi functionality to the
> overall administrator.
> I can probably hide the security tabs using css (the overall admin
> won't load the css sheet) but how can I control the products displayed
> to a user in the folder view of the zmi?
You can either sub-class if you want to explicitely specify the products
you want an objectmanagerish class to add - this would also nicely solve
all your ZMI "problems" since you could just skin your new pages as you
want. Or for the easy way have a look at the Security Tab, specifically
at the "Add FooBar..." stuff there.
Regards
Tino
From tino at wildenhain.de Thu Jan 17 03:01:32 2008
From: tino at wildenhain.de (Tino Wildenhain)
Date: Thu Jan 17 03:35:23 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <2157EB20ECBCED46B10672C2@[192.168.0.24]>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
<2157EB20ECBCED46B10672C2@[192.168.0.24]>
Message-ID: <478F0B5C.1050104@wildenhain.de>
Andreas Jung wrote:
...
> Iframes are still a valid choice in case asynchronous won't work e.g.
> when you need to load resources from servers != your origin server. Due
> the security model of asynchronous requests, a browser will only load
> stuff from the origin server. Iframes are a way to work around this
> limitation - ugly as you said, but sometimes a good workaround.
Not only ugly but also a very security threat. Been there, seen a lot
important sites fell on their noses when it comes to CSS* and friends.
Better find another solution in such cases and allow users to disable
support for iframes for better security.
*) here: cross site scripting
Regards
Tino
From bba at inbox.com Thu Jan 17 08:39:56 2008
From: bba at inbox.com (Ben Bartrum)
Date: Thu Jan 17 08:39:57 2008
Subject: [Zope] problem authenticating, even with emergency user
Message-ID: <6E286E94578.0000020Fbba@inbox.com>
Hello
A Zope site which is running fine, is refusing all authentication with the error below. I have tried the emergency user and restarted Zope, but the emergency user gets the same error:
Site Error
An error was encountered while publishing this resource.
AttributeError
Sorry, a site error occurred.
Traceback (innermost last):
Module ZPublisher.Publish, line 188, in publish_module_standard
Module Products.PlacelessTranslationService.PatchStringIO, line 51, in new_publish
Module ZPublisher.Publish, line 145, in publish
Module Zope2.App.startup, line 222, in zpublisher_exception_hook
Module ZPublisher.Publish, line 105, in publish
Module ZPublisher.BaseRequest, line 446, in traverse
Module ZPublisher.BaseRequest, line 550, in old_validation
AttributeError: __getitem__ (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: getUserById)
____________________________________________________________
Receive Notifications of Incoming Messages
Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!
From jens at dataflake.org Thu Jan 17 09:00:40 2008
From: jens at dataflake.org (Jens Vagelpohl)
Date: Thu Jan 17 09:00:44 2008
Subject: [Zope] problem authenticating, even with emergency user
In-Reply-To: <6E286E94578.0000020Fbba@inbox.com>
References: <6E286E94578.0000020Fbba@inbox.com>
Message-ID: <93EE32C3-2691-4342-9F73-C5D975B1C209@dataflake.org>
On Jan 17, 2008, at 14:39 , Ben Bartrum wrote:
> Hello
>
> A Zope site which is running fine, is refusing all authentication
> with the error below. I have tried the emergency user and
> restarted Zope, but the emergency user gets the same error:
>
>
> Site Error
> An error was encountered while publishing this resource.
> AttributeError
> Sorry, a site error occurred.
> Traceback (innermost last):
> Module ZPublisher.Publish, line 188, in publish_module_standard
> Module Products.PlacelessTranslationService.PatchStringIO, line 51,
> in new_publish
> Module ZPublisher.Publish, line 145, in publish
> Module Zope2.App.startup, line 222, in zpublisher_exception_hook
> Module ZPublisher.Publish, line 105, in publish
> Module ZPublisher.BaseRequest, line 446, in traverse
> Module ZPublisher.BaseRequest, line 550, in old_validation
> AttributeError: __getitem__ (Also, the following error occurred
> while attempting to render the standard error message, please see
> the event log for full details: getUserById)
I bet you're running a non-standard user folder, and for some reason
the user folder instance is broken. If you can't find why it is broken
and the broken user folder is at the root of your Zope instance then
fixing it would involve work in the debugger to delete the old one and
create a new standard user folder.
jens
From tom at modscape.com Thu Jan 17 09:22:35 2008
From: tom at modscape.com (Tom Von Lahndorff)
Date: Thu Jan 17 09:22:37 2008
Subject: [Zope] Plone middle aligns all colums
In-Reply-To: <9A6213D6CEDE5147A5FA6559410C363D02A4D9C5@Mail1.ktd.com>
References: <9A6213D6CEDE5147A5FA6559410C363D02A4D9C5@Mail1.ktd.com>
Message-ID: <50ABA9E9-1FF9-4D6E-A7C6-20DBA3EA8606@modscape.com>
If you've introduced tables into the overall layout tds will not align
the content to the top by default. You'd need to add "td {vertical-
align: top}" to your css. I doubt the problem has to do with a setting
in Plone or Zope. It would be easier to trouble shoot this if there
were a link to the page in question.
On Jan 16, 2008, at 9:40 PM, Lars Hohmuth wrote:
> I have a weird problem with our Plone 2.5.3 test site after a new
> designer took over. Plone now middle aligns the content column and
> the portlets in the slot on the center line, instead of on top.
>
>
> --------------------
>
> ---------------------------
> | Left-slots |
> | | center
> | |
> ---------------------------
>
> ---------------------
>
> We can sort of fix this by manually adding vertical-align: top; in
> the css. But my designer claims that he caused this by ?changing a
> setting in Plone or the ZMI? and doesn?t remember which one.
>
> Since it?s not on the production site, it?s not a life and death
> situation, but any suggestions what might cause this are gratefully
> accepted. Google and the Plone site search yielded pretty much
> nothing.
>
> Thanks,
> Lars Hohmuth
>
> _______________________________________________
> 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 )
From tom at modscape.com Thu Jan 17 09:25:56 2008
From: tom at modscape.com (Tom Von Lahndorff)
Date: Thu Jan 17 09:25:58 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
<2157EB20ECBCED46B10672C2@192.168.0.24>
<75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
Message-ID: <897C0252-A322-4EF3-96BE-EF859F147FA7@modscape.com>
You really should be writing a custom UI for this rather than hacking
the ZMI. It will probably take less time, be much more manageable,
flexible and secure.
On Jan 16, 2008, at 8:05 PM, Tim Nash wrote:
> The other important difference between ajax loaded pages and iframes
> is that when you click on a link within an iframe page, the returned
> page is loaded into the same iframe.
> If I am not being clear, please check out this png file.
>
> http://medicinebrain.com/iframe.png
>
> In this png I did a search for DML Docs within a tab panel and the
> search results are loaded into the same tab.
>
> BTW, I would like to simplify the zmi even more for my users. I want
> to hide various tabs (eg. security, find, etc) and I want to restrict
> the number of products they are shown in the drop down box for adding
> to a folder.
> However, I still want to offer complete zmi functionality to the
> overall administrator.
> I can probably hide the security tabs using css (the overall admin
> won't load the css sheet) but how can I control the products displayed
> to a user in the folder view of the zmi?
>
> Thanks,
> Tim
>
>
>
> On Jan 16, 2008 9:54 AM, Andreas Jung wrote:
>>
>>
>> --On 16. Januar 2008 09:33:58 +0100 Tino Wildenhain > >
>> wrote:
>>
>>
>>> Tim Nash wrote:
>>>> Jurian,
>>>> While the ZMI is a bit geeky for the average user, it works quite
>>>> well inside an iframe.
>>>> iframes are used by many ajax/web2 (whatever you want to call it)
>>>> libraries. So in my application (for example) I currently make ajax
>>>> calls to load specific zmi pages inside tabs of a window layout.
>>>
>>> IFRames. You should avoid those. With ajax or similar its easy to
>>> skip
>>> such stuff and just replace any named container tag.
>>
>> Iframes are still a valid choice in case asynchronous won't work
>> e.g. when
>> you need to load resources from servers != your origin server. Due
>> the
>> security model of asynchronous requests, a browser will only load
>> stuff
>> from the origin server. Iframes are a way to work around this
>> limitation -
>> ugly as you said, but sometimes a good workaround.
>>
>> Ansdeas
> _______________________________________________
> 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 )
From thedagdae at gmail.com Thu Jan 17 10:17:42 2008
From: thedagdae at gmail.com (Tim Nash)
Date: Thu Jan 17 10:17:47 2008
Subject: [Zope] Zope ZMI Templates
In-Reply-To: <897C0252-A322-4EF3-96BE-EF859F147FA7@modscape.com>
References: <14734109.post@talk.nabble.com> <478D0329.1010004@fry-it.com>
<75c632a00801151838n4103fbb8tb2068e6e8cbd68ad@mail.gmail.com>
<478DC176.3000802@wildenhain.de>
<2157EB20ECBCED46B10672C2@192.168.0.24>
<75c632a00801161705g7c1dd79fme91a6bdb2b39aa94@mail.gmail.com>
<897C0252-A322-4EF3-96BE-EF859F147FA7@modscape.com>
Message-ID: <75c632a00801170717j19e7bef4wdb5ac258ae560c26@mail.gmail.com>
Tom,
Thanks but I think I am almost done. I have replaced the old