Re: [Zope3-Users] So, there is going to be no Zope4... how to handle maintenance a couple of years from now?

2014-09-07 Thread Thierry Florac

Hi,

Le Sun, 7 Sep 2014 09:26:43 +0530,
  Milind Khadilkar zedobj...@gmail.com a écrit:

 Seems there will be no Zope4. Puts a fond hope to rest.
 
 I have one large Zope2 (Zope 2.6) project, one large Zope3 (Zope 3.4)
 project, two medium sized Grok projects, one GAE project, allof them
 need to be maintained beyond two years.
 I would like, if possible, to redevelop them using ONE single
 framework. While some of the original developers are available, most
 work would need to be done through people who need to be trained from
 the ground up.
 
 My first choice (mainly because I have a complex Zope3 project to
 redevelop) would be Bluebream, even if it means using ZCML and
 programming in ZCA-shackles. But I am speaking without any real
 experience of it. (Negative press ensured that I did not go for it...)
 
 Any suggestions?

If you are considering a complete re-development, maybe you should have
a look at Pyramid.
It allows you to reuse a lot of Zope related technologies, including
ZODB, traversing and even ZCA ! ;-)

I use and develop ZTFY which is based on Bluebream (with updated
packages based on ZTK) and which is used in many of my own projects
with great success, but which is probably condamned to death in a
relatively near future...

Regards,
Thierry


P.S.: by the way, I don't really understand where is the real problem
with ZCA (which is so powerful, and not so complicated!) and with ZCML
(which is nothing in XML files terms compared to any serious Java
server development environment...)
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Installation problems with ztfy.webapp on fresh baked gentoo!

2013-07-23 Thread Thierry Florac

Could you give me your versions of setuptools, distribute and
zc.buildout ?

Thierry


Le Sat, 20 Jul 2013 01:36:34 +0200,
  Tamer Higazi th9...@googlemail.com a écrit:

 Same result as before.
 
 I tried it globally as well as in a virtualenv
 
 
 
 Tamer
 
 
 On 07/20/13 01:19, Thierry Florac wrote:
  
  Hi,
  
  Le Sat, 20 Jul 2013 01:09:50 +0200,
Tamer Higazi th9...@googlemail.com a écrit:
  
  I believe also that it is not related to ztfy packages, because the
  same result is being displayed with bluebream as well.
 
  I am using Python 2.7.5 on Gentoo Linux 64 Bit.
  
  I already had a few installation problem with zc.buildout in release
  2.x.
  Can you try to install release 1.5.2 of zc.buildout ?
  (easy_install zc.buildout==1.5.2)
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Installation problems with ztfy.webapp on fresh baked gentoo!

2013-07-23 Thread Thierry Florac

Hi,

I've tried to create a new ztfy.webapp site from a fresh virtual
environment and didn't had any real problem.
I've tried using several environments (based on setuptools or
distribute) always with good results.
The only thing I had to do was to upgrade my setuptools package
(easy_install -U setuptools or pip install -U setuptools).

I work with an up-to-date Debian sid operating system (unstable,
amd64).

Regards,
Thierry


Le Sat, 20 Jul 2013 01:36:34 +0200,
  Tamer Higazi th9...@googlemail.com a écrit:

 Same result as before.
 
 I tried it globally as well as in a virtualenv
 
 
 
 Tamer
 
 
 On 07/20/13 01:19, Thierry Florac wrote:
  
  Hi,
  
  Le Sat, 20 Jul 2013 01:09:50 +0200,
Tamer Higazi th9...@googlemail.com a écrit:
  
  I believe also that it is not related to ztfy packages, because the
  same result is being displayed with bluebream as well.
 
  I am using Python 2.7.5 on Gentoo Linux 64 Bit.
  
  I already had a few installation problem with zc.buildout in release
  2.x.
  Can you try to install release 1.5.2 of zc.buildout ?
  (easy_install zc.buildout==1.5.2)
  
  
  Regards,
  Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Installation problems with ztfy.webapp on fresh baked gentoo!

2013-07-19 Thread Thierry Florac

Hi,

Le Fri, 19 Jul 2013 23:43:54 +0200,
  Tamer Higazi th9...@googlemail.com a écrit:

 Hi peeople!
 I sent by mistake this question to the zope2 Mailinglist, and I hope
 you forgive me. I have this problem:
 
 I am trying to install zope3 /ztfy webapp, and I face quickly a
 problem by running python bootstrap.py after application setup.
 Here the problem:
 
 README.txt  bootstrap.py  buildout.cfg  debug.ini  deploy.ini  etc 
 extends-cache  setup.py  src  var
 tamer@tux /storage/PyProjects/ztfyAPP $ python bootstrap.py
 Traceback (most recent call last):
   File bootstrap.py, line 111, in module
 ws.find(pkg_resources.Requirement.parse(requirement)).location
 AttributeError: 'NoneType' object has no attribute 'location'
 
 This problem appears if I try to setup bluebream or a ztfy project
 and I am not getting smart. what could it be?! 
 
 I already spoke with somebody who had the same problem. He installed
 zc.builout globally, and it was solved for him but not me.
 
 My problem still exist even after installing through easy_install
 zc.buildout globally.
 
 Any ideas what it could be?!
 
 For any help I would kindly thank you


I don't think that this problem is strictly related to ZTFY packages.

Which Python version do you use ? On what operating system ??
I'm the creator and maintainer of all ZTFY packages, which are actually
only compatible with Python 2.6 and 2.7.

Regards,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Installation problems with ztfy.webapp on fresh baked gentoo!

2013-07-19 Thread Thierry Florac

Hi,

Le Sat, 20 Jul 2013 01:09:50 +0200,
  Tamer Higazi th9...@googlemail.com a écrit:

 I believe also that it is not related to ztfy packages, because the
 same result is being displayed with bluebream as well.
 
 I am using Python 2.7.5 on Gentoo Linux 64 Bit.

I already had a few installation problem with zc.buildout in release
2.x.
Can you try to install release 1.5.2 of zc.buildout ?
(easy_install zc.buildout==1.5.2)


Regards,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] SSL permission error

2013-04-18 Thread Thierry Florac
Hi,

 my server sometimes stops running. I use apache2 in front of zope3 with
 rewrite rules. Here's the transcript.log :

 Traceback (most recent call last):
   File /var/lib/zope3/instance/www.test.com/bin/runzope, line 48, in ?
 run()
   File /var/lib/zope3/instance/www.test.com/bin/runzope, line 44, in run
   main([-C, CONFIG_FILE] + sys.argv[1:])
   File /usr/lib/python2.4/site-packages/zope/app/twisted/main.py, line
 73, in main
 service = setup(load_options(args))
   File /usr/lib/python2.4/site-packages/zope/app/twisted/main.py, line
 152, in setup
 service = server.create(db)
   File /usr/lib/python2.4/site-packages/zope/app/twisted/server.py, line
 187, in create
   backlog=self.backlog,
   File /usr/lib/python2.4/site-packages/zope/app/twisted/server.py, line
 108, in create
   contextFactory = ssl.DefaultOpenSSLContextFactory(
   File /usr/lib/python2.4/site-packages/twisted/internet/ssl.py,
 line
 78, in __init__
   self.cacheContext()
   File /usr/lib/python2.4/site-packages/twisted/internet/ssl.py,
 line
 82, in cacheContext
   ctx.use_certificate_file(self.certificateFileName)
   OpenSSL.SSL.Error: [('system library', 'fopen', 'Permission
 denied'),
 ('BIO routines', 'FILE_CTRL', 'system lib'), ('SSL routines',
 'SSL_CTX_use_certificate_file', 'system lib')]

 It seems coming from the SSL certificate file with a permission error.


It seems that you're using Python2.4, which is quite old now.
What Zope version are you using ??

Regards,
Thierry


___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Choosing between Bluebream, Zope2 and Grok

2012-10-24 Thread Thierry Florac

Hi,

Le Wed, 24 Oct 2012 07:45:50 +0530,
  Milind Khadilkar zedobj...@gmail.com a écrit:

 Hello all Zope Users!
 We are trying to decide on a Zope platform for, say, the next five
 years. We have developed small products on Zope2 and Zope3 between
 2000 and 2008, and in Grok over the past couple of years, off and on.
 We are looking to build as per customer requirements, and it would be
 common sense to choose the platform as per requirement. However, with
 a small team size, we can't spread ourselves thin over the three
 platforms...Pyramid, Django and GAE also keep beckoning
 
 We have seven revivable products in Zope2 (2.6 - 2.10), including one
 in Plone. Some of them do not open in Zope 2.11...
 Some of them use DTML for no reason now discernable.
 Some of them use a very old version of ZODB.
 
 We have one big product in Zope 3.3.  Can we attempt converting it
 from Zope 3 to Zope2?
 
 We have no real work done in Grok, but there is a level of
 familiarity with it. Newer members of the team know neither Zope2 nor
 Zope3.
 
 Making use of our past work is an important criterion for us.
 Training new team members is another...
 
 What other things must we keep in mind when deciding on the platform?
 Any pointers would help.
 
 Sorry for this rambling question.
 Thanks in advance for your answers.

Using Zope 2 for several years, I switched to Zope 3.3 probably five
years ago and our latest developments since two years are based on ZTK
and ZopeApp. We are really very happy with these!

Having small teams of developers, mainly coming from the Java world,
training them for recent environments was more natural and easier to
them than it was for Zope 2.

The main problem with these releases is that BlueBream as is is a
dead project; I only used it as a base to create my new development
environments based on recent releases of ZTK and ZopeApp packages.
These ZTK and ZopeApp packages are still maintained (last release was
in May, 2012) but don't seems to evolve much actually (even if
development work seems to be visible in Launchpad). Development
community on these packages don't seems to be very active or is, at
least, hard to find! Same for Grok, for which the last release was 18
months ago.

Excluding Django, Pyramid seems to be the most active project actually
among those you mentioned. And it can include many old Zope concepts
(ZODB, traversing...). But I didn't had any time to test it until now...

Best regards,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] KGS for ZTK 1.1.1 ?

2011-05-27 Thread Thierry Florac
Hi,

I've seen that ZTK and ZopeApp packages have been released in version
1.1.1 since april, 2011.
Is there any KGS, mainly for zc.* and z3c.* packages, matching this
release ?

Thanks,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Referencing objects

2011-02-04 Thread Thierry Florac
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,


Le vendredi  4 février 2011,
  Michael Seifert michael.seif...@gmx.net a écrit :
==
 Hello everyone,
 
 I recently started a Zope3 project, but I am stuck at the very
 beginning. Although I have some experience with Zope2, the more
 flexible approach to developing web applications was giving me a
 really hard start. Let me point out my situation:
 I created a container hierarchy which is stored in ZODB. Say I have a
 set of object types A, B, C, D, whose relationships look like the
 following (edges represent containment, i.e. A contains B,... where B
 and D are in subcontainers of A):
 
 A
/ \
   B   D
   |
   C
 
 C has an attribute referencing an object of type D. As this attribute
 is mandatory on creation, I created a vocabulary, which ascends the
 hierarchy from the current context until it reaches A and returns all
 objects of type D.
 Now the part that doesn't work:
 While ascending from C to B and from B to A works fine, descending
 from A to D returns a security proxied object and since these objects
 cannot be pickled, I cannot store it's reference in the attribute of
 C.
 
 1. Is this the way it's meant to be done? :) What is your opinion of
 storing B and D objects in subcontainers of A?

That shouldn't be a problem, it's not different when you use a basic
folder-like container which, internally, stores sub-objects in an
internal b-tree container ; the only difference here is that you own
two internal containment attributes.


 2. Are there any means to turn the vocabulary into trusted code, so it
 will not be encapsulated in a proxy (without deactivating the security
 proxy)?

Perhaps can you use the removeSecurityProxy function ?


 3. How do you reference objects like you do with foreign keys in
 relational databases? I want to do this to prevent objects from being
 saved multiple times.

If the targetted object is persistent (and so a subclass of
Persistent class), it should be stored only once in the database
(just try to alter properties of an object and check if the other one
is also modified or not to check !)
Another way I commonly use to store references is to store only an
IIntIds utility reference, which is an integer ; the benefit of this
is that this value can easilly be indexed.

Regards,
Thierry
- -- 
Chef de projets intranet/internet
Office National des Forêts - Département Informatique
2, Avenue de Saint-Mandé
75570 Paris Cedex 12
Tél. : 01 40 19 59 64
Fax. : 01 40 19 58 85
Mél. : thierry.flo...@onf.fr
Web. : http://www.onf.fr
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk1MI5EACgkQNl1a1Vtu7wrpzACeLPBWLaKoVVQn+fueivqnwhJb
jSwAn1LWhDCBnleB+jsfU/VoiJH0eBKD
=sWJB
-END PGP SIGNATURE-
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Bluebream

2010-10-30 Thread Thierry Florac
__
Le samedi 30 octobre,
  Albert DURANTON albert.duranton...@orange.fr a écrit :

 I learn bluebream with bluebream documentattion. After chap1 i run
 bin/paster serve debug.ini. I get :
 r...@mamachine:/home/albert2/bluebream/ticketcollector# bin/paster
 serve debug.ini Traceback (most recent call last): File bin/paster,
 line 116, in paste.script.command.run()
 File
 /home/albert2/bluebream/ticketcollector/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 84, in run invoke(command, command_name, options, args[1:]) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 123, in invoke exit_code = runner.run(args) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/command.py,
 line 218, in run result = self.command() File
 /home/albert2/bluebream/ticketcollector/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py,
 line 276, in command relative_to=base, global_conf=vars) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py,
 line 313, in loadapp **kw) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 204, in loadapp return loadobj(APP, uri, name=name, **kw) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 224, in loadobj global_conf=global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 248, in loadcontext global_conf=global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 278, in _loadconfig return loader.get_context(object_type, name,
 global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 400, in get_context global_additions=global_additions) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 474, in _filter_app_context APP, next_name, global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 409, in get_context section) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 431, in _context_from_use object_type, name=use,
 global_conf=global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 361, in get_context global_conf=global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 248, in loadcontext global_conf=global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 285, in _loadegg return loader.get_context(object_type, name,
 global_conf) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 561, in get_context object_type, name=name) File
 /home/albert2/bluebream/ticketcollector/eggs/PasteDeploy-1.3.3-py2.6.egg/paste/deploy/loadwsgi.py,
 line 581, in find_egg_entry_point pkg_resources.require(self.spec)
 File /usr/lib/python2.6/dist-packages/pkg_resources.py, line 654,
 in require needed = self.resolve(parse_requirements(requirements))
 File /usr/lib/python2.6/dist-packages/pkg_resources.py, line 556,
 in resolve raise VersionConflict(dist,req) # XXX put more info here
 pkg_resources.VersionConflict: (mechanize 0.1.11
 (/usr/lib/python2.6/dist-packages),
 Requirement.parse('mechanize=0.2.0')) I mechanise 0.2.0 in
 buildout.cfg, How use mechanize 0.1.11 in my buildout.cfg or other
 solution ? Merci d'avance. I am blocked and i can not continue. Dudu
__


Hi,

You probably have a mechanize package (0.1.11) in your default Python
install and another one (0.2.0) in your Buildout eggs directory.
Maybe you should try to create an isolated environment (without site
packages) using Virtualenv ??

Regards,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3-users Digest, Vol 71, Issue 2

2010-10-11 Thread Thierry Florac
__
Le dimanche 10 octobre,
  david ally dade.a...@gmail.com a écrit :

 Ok, I couldn't create a project however, please see the error I got
 when tried zopeproject LearningZope;
 
 da...@ubuntu104:~$ zopeproject LearningZope
 Enter user (Name of an initial administrator user): david
 Enter passwd (Password for the initial administrator user): test
 Enter eggs_dir (Location where zc.buildout will look for and place
 packages) ['/home/david/buildout-eggs']:
 While:
   Initializing.
 
 An internal error occurred due to a bug in either zc.buildout or in a
 recipe being used:
 Traceback (most recent call last):
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py,
 line 1783, in main
 user_defaults, windows_restart, command)
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py,
 line 198, in __init__
 data['buildout'].copy(), override))
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py,
 line 1431, in _open
 eresult = _open(base, extends.pop(0), seen, dl_options, override)
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/buildout.py,
 line 1381, in _open
 path, is_temp = download(filename)
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/download.py,
 line 96, in __call__
 local_path, is_temp = self.download(url, md5sum, path)
   File
 /usr/local/lib/python2.6/dist-packages/zc.buildout-1.5.1-py2.6.egg/zc/buildout/download.py,
 line 173, in download
 tmp_path, headers = urllib.urlretrieve(url, tmp_path)
   File /usr/lib/python2.6/urllib.py, line 93, in urlretrieve
 return _urlopener.retrieve(url, filename, reporthook, data)
   File /usr/lib/python2.6/urllib.py, line 237, in retrieve
 fp = self.open(url, data)
   File /usr/lib/python2.6/urllib.py, line 205, in open
 return getattr(self, name)(url)
   File /usr/lib/python2.6/urllib.py, line 344, in open_http
 h.endheaders()
   File /usr/lib/python2.6/httplib.py, line 904, in endheaders
 self._send_output()
   File /usr/lib/python2.6/httplib.py, line 776, in _send_output
 self.send(msg)
   File /usr/lib/python2.6/httplib.py, line 735, in send
 self.connect()
   File /usr/lib/python2.6/httplib.py, line 716, in connect
 self.timeout)
   File /usr/lib/python2.6/socket.py, line 514, in create_connection
 raise error, msg
 IOError: [Errno socket error] [Errno 110] Connection timed out
 
 Please help!
__


Hi,

Did you install ZopeProject from an Ubuntu package (which may also
be outdated) or with easy_install ?
You also need an internet connection while creating your project to
download packages... Is it OK ??

A good way to install ZopeProject and all Zope3 dependencies is with
VirtualEnv ; you can find a quick tutorial on my own web site :

 - http://www.ztfy.org/installation/virtualenv/virtualenv.html
 - http://www.ztfy.org/installation/zopeproject/zopeproject.html

Hope this helps,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope 3.4.1 KGS released!

2010-06-25 Thread Thierry Florac
Le jeudi 24 juin 2010,
  Adam GROSZER agros...@gmail.com a écrit :
==
 ==
 Zope 3.4.1 Released!
 ==
 
 June 22, 2010 - The Zope 3 development team announces the Zope 3.4.1
 release.
 
 The 3.4.1 is the long awaited next bugfix version of 3.4.0.
 
 Major changes
 ~
 
 - setuptools update to 0.6c11, so that it supports svn 1.6.
 
 - z3c.layer update to 0.2.4, which is a **SECURITY** fix.
 
 For details see the changelog.
==


Hi,

I've tried to build a new zc.buildout based project this morning using
Zope-3.4.1 versions.cfg as reference.

I think there's a small problem with zope.configuration package, as
release 3.4.1 mentionned in KGS is not available on Pypi...

Hope this helps,
Thierry
-- 
Chef de projets intranet/internet
Office National des Forêts - Département Informatique
2, Avenue de Saint-Mandé
75570 Paris Cedex 12
Tél. : 01 40 19 59 64
Fax. : 01 40 19 58 85
Mél. : thierry.flo...@onf.fr
Web. : http://www.onf.fr

___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ZEO multi-processes client setup with WSGI

2010-06-24 Thread Thierry Florac

Hi,

I'm currently going to setup a new Zope3 web site.
I'd like to setup this site using :
 - a remote ZEO server
 - several physical web servers, each hosting a set of ZEO clients and
   using WSGI (with mod_wsgi).

My main question is about mod_wsgi multi-processes setup, and
actually : if defining several processes (ideally, one for each CPU
core), can several ZEO clients processes share the same ZEO cache ??

Many thanks for any help or advise about this kind of setup...

Thierry
-- 
Chef de projets intranet/internet
Office National des Forêts - Département Informatique
2, Avenue de Saint-Mandé
75570 Paris Cedex 12
Tél. : 01 40 19 59 64
Fax. : 01 40 19 58 85
Mél. : thierry.flo...@onf.fr
Web. : http://www.onf.fr

___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Multi-database settings for Zope3

2010-04-06 Thread Thierry Florac

Hi,

I have to build a new application, including several virtual
hosts each matching a different ZODB accessed via ZEO.

Is there any easy way to handle such a configuration in a
single Zope3 instance (I still use Zope-3.4) ?
I used to use ZODB mount points with old Zope2 applications, but didn't
found any equivalent option with Zope3.

Thanks for any help or hint,
Thierry
___
Zope3-users mailing list
Zope3-users@zope.org
https://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Assigning programmatically a Role to a Principal

2009-05-12 Thread Thierry Florac
Le mardi 12 mai 2009,
  paftek paf...@gmail.com a écrit :
==
 I created a Role and a Permission affected to it :
 role id=app.User title=Utilisateur /
 permission id=app.Auth title=Utilisateur authentifié /
 grant permission=app.Auth role=app.User /
 
 My users are store in a PostgreSQL database, not in the ZODB.
 I use the Zope authentication system to return a PrincipalInfo when an
 user log in.
 
 I do not know how to assign my app.User Role to the Principal who
 log in. I tried the following, without success :
 
 @adapter(IAuthenticatedPrincipalCreated)
 def setPermission(event):
 role_map = IPrincipalRoleManager(getSiteManager())
 role_map.assignRoleToPrincipal('app.User', event.principal.id)
==

Hi,

What do you mean when you say without success ?
What do you get when you look at the @@grant.html view over your
context ??

Thierry
-- 
Chef de projets intranet/internet
Office National des Forêts - Département Informatique
2, Avenue de Saint-Mandé
75570 Paris Cedex 12
Tél. : 01 40 19 59 64
Fax. : 01 40 19 58 85
Mél. : thierry.flo...@onf.fr
Web. : http://www.onf.fr

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] TextIndexNG question...

2009-02-18 Thread Thierry Florac
Hi,

I'm currently using TextIndexNG (release 3.2, I think...) to index
documents in a Zope3 application.
Indexed documents are multi-linguals ; I've created one index for each
field and each language, because all fields are not indexed in the same
way (for example, I use stopwords on documents contents but not on
titles).

Everything is **nearly** fine, except for one thing : in french, I have
to index a word like (for example)  l'eau  ; the important word is
eau here so, so while searching on title I would like to get a result
while entering query eau as well as  l'eau .
Actually, none of them is working !

I tried to debug a bit, and noticed (if I'm not wrong), that :
 - it's the word  leau  which is computed for indexing
 - but the query  l'eau  is not modified while searching.

I suppose that all this is a splitter/stopwords problem, but I can't
manage to make this work correctly so any help would be greatly
appreciated.


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.flo...@onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Run starup code with zope 3.

2009-02-12 Thread Thierry Florac
Le jeudi 12 février 2009 à 17:50 +0100, Sebastian Bartos a écrit :
 I'm struggling with some Zope 3 startup code. I registered a user like
 this for the Session Credentials plugin and login form stuff:
 
 ...
 
 def create(self, data):
 site = getSite()
 sm = site.getSiteManager()
 
 if sm.has_key('auth'):
 return Site is already set up
 
 pau = Pluggableauth()
 sm['auth'] = pau
 sm.registerUtility(pau, Iauth)
 users = PrincipalFolder()
 sm['auth']['Users'] = users
 sm.registerUtility(users, IAuthenticatorPlugin, name=Users)
 pau.authenticatorPlugins = (users.__name__, )
 pau.credentialsPlugins = (No Challenge if Authenticated,
   Session Credentials)
 
 user = InternalPrincipal(user, foo, user,
  passwordManagerName=SHA1)
 users[user] = user
principalPermissionManager.grantAllPermissionsToPrincipal(user)


To run code automatically at application startup, I think that you
should have a look at the IDatabaseOpenedWithRootEvent (defined in
zope.app.appsetup.interfaces).
I use this event to check a set of persistent database utilities at
application startup, and it works fine.

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.flo...@onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zc.catalog NormalizationWrapper question...

2008-12-18 Thread Thierry Florac
Le jeudi 18 décembre 2008 à 11:03 -0500, Gary Poster a écrit :
 On Dec 18, 2008, at 9:52 AM, Thierry Florac wrote:
 
  Hi,
 
  I'm currently using zc.catalog package for value and set indexes on a
  Zope-3.3 application.
 
  I'd also like to use DateTimeValueIndex and DateTimeSetIndex and their
  normalization wrappers to retrieve informations from date-based  
  queries,
  and now just have a small question : in the function which defines  
  these
  index (in catalogindex.py), resolution is set to 2 with a comment  
  which
  says Hour - good for per-day searches, while in interfaces.py the
  resolution of 2 is given for minutes...
 
 2 is for minutes.  Doctest confirms.
 
 comment in catalogindex.py is buggy.  Feel like adjusting?  Perhaps  
 simply noting per-minute?  Or perhaps it would be nice to make some  
 constants in interfaces.py around where the vocabulary is made?
 
  I understood until now that I should use 0 for date-based indexation
  and queries...
 
 I suggest hourly for date-based searches *if multiple time-zones are  
 in effect*, so one person's date would not be the same as someone  
 else's for an event that happens at a particular (UTC) time.
 
 If you don't care about that use case, 0 should work.

All right !
Many thanks for your precise answer...

It's not a big deal to adjust these small settings, but I don't have any
write access to zc package CVS server...


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.flo...@onf.fr
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Zope3 and SQLAlchemy

2008-11-18 Thread Thierry Florac
Hi,

I currently have to integrate an SQL database (PostgreSQL, with PostGIS
extensions) into my Zope3 application.
I'd like to use SQLAlchemy to handle this, and I've seen that several
packages are available : z3c.zalchemy, z3c.sqlalchemy,
zope.sqlalchemy...

So my questions are simple :
 - what package is the best to plug into my Zope (3.3.1) application ?
 - do all these packages handle the same features ??

Thanks for any information,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Last zc.async package for Zope-3.3.1

2008-10-20 Thread Thierry Florac

  Hi,

Actually using Zope-3.3.1, I'm looking at zc.async package but the last
release is no more compatible with my Zope release.

Could anyone point me to the last compatible release ??

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] How to add content in HTML head ?

2008-09-18 Thread Thierry Florac

  Hi,

I'm actually building an application with Zope3 (3.3.1).
One of my components (a content provider) provides a list of elements,
for which I should provide an RSS URL.

My question is simple : how can I automatically put the 'link' tag in
HTML head as soon as this component is displayed in any template ?
I already use zc.resourcelibrary package, which handles the same kind of
problem for JS/CSS resources...

Thanks for any help or link...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Copying Objects from/in the ZODB

2008-07-27 Thread Thierry Florac
Le dimanche 27 juillet 2008 à 15:15 -0300, Tim Cook a écrit :
 Hi All,
 
 Another basic question but I can't seem to find the easy way to do this.
 
 
 I have a group of instances stored in the ZODB.  They are basically
 skeletons that I want to copy, edit and store as new instances elsewhere
 in the ZODB.  In Zope2.x this was fairly obvious to me.  Using the ZCA
 it isn't so obvious.  Is there a class I should be inheriting from to do
 this or do I need to provide a copy method in the class itself?  
 
 If the later; are there any good examples?


Hi,

Have a look at zope.copypastemove package interfaces and classes ;
they should provide the simple functions you are looking for...

  Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Preferred languages

2008-04-17 Thread Thierry Florac
Le jeudi 17 avril 2008 à 12:53 +0200, Frank Burkhardt a écrit :
 there's a problem with my web application. It's written in Zope 3
 and makes heavy use of i18n (- _(...), i18n:translate, ...).
 
 I extracted the english strings and made a german translation (language code
 'de'). Whenever my browser's most preferred language is 'de' or 'de-de'
 (example: Accept-Language: de-de,en;q=0.5 ), everything works fine.
 
 But when I switch to 'en','de' (example: Accept-Language: en,de-de;q=0.5 ,
 the result is unexpected. Zope returns german translations although english
 strings are available (hardcoded into the application).
 
 Is there a way to tell Zope to use the hardcoded strings, when 'en' is
 requested?

Hi,

I currently use z3c.language.(switch|negotiator|session) packages to
handle internationalization.
It works correctly for me...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] TextIndexNG ranking questions

2008-04-15 Thread Thierry Florac

  Hi,

I'm currently using TextIndexNG-3.2.0 as well as other zc.catalog
indexes in a Zope-3.3.1 application.
Indexing several fields as well as external files seems OK, but now I'm
facing a few interrogations about searching and ranking :

1. I've created TXNG indexes with a term_frequencies storage and
ranking enabled = OK

2. I'm now using hurry.query package to run queries on a set of
catalogs ; it's generally OK but my main question are :

- how can I use TXNG ranking feature when running a single query against
several indexes (actually I have to run queries against several
ValueIndex indexes, matching workflow status and publication date, and
one or two TextIndexNG indexes -- one for title and another one for
content) ? How can I be sure that my results order is matching
ranking ??

- does a ranking query generate a numeric value which could be used to
display to users the relevance of found results ?


Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] TextIndexNG ranking questions

2008-04-15 Thread Thierry Florac
Le mardi 15 avril 2008 à 13:18 +0200, Andreas Jung a écrit :
 Using the ranking of TextIndexNG makes basially only sense when you perform 
 a query against the index alone - not in combination with queries against 
 other fields.

Yes, that's what I thought... :-(
So is there an easy way to intersect the results of several distinct
queries, so that the results order provided by TextIndexNG and following
ranking is kept ??

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] TextIndexNG ranking questions

2008-04-15 Thread Thierry Florac
Le mardi 15 avril 2008 à 14:03 +0200, Andreas Jung a écrit :
 Intersection is likely possible. However I don't know about the 
 implementation of hurry.catalog or the other related Zope 3 components.
 Performing two queries and intersecting the results (e.g. given by paths,
 UIDs or whatever) is basically supported through the various BTree types
 or Zope or by Python's set module..

Intersecting is possible, but BTrees and sets dont support ordering...
So I suppose that I have to convert search results to lists and to
merge/intersect them manually...
Or, given a set (containing final results set intersection) and a list
(containing TextIndexNG results, ordered by ranking), is it possible to
EFFICIENTLY get items of the set in the order in which they are stored
in the list ??

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


{Spam?} Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-28 Thread Thierry Florac
On mer, 2008-03-19 at 06:33 -0700, garz wrote:

 have some views for some content:
 class SomeContentDisplayForm(z3c.formui.layout.FormLayoutSupport,
 z3c.form.form.DisplayForm):
   fields = z3c.form.field.Fields(ISomeConcent)
 class SomeContentEditForm(z3c.formui.layout.FormLayoutSupport,
 z3c.form.form.EditForm):
   fields = z3c.form.field.Fields(ISomeConcent)
 
 if i try to use the view, a componentlookuperror is raised:
 IFieldWidgets cant be looked up
 
 i thought, the errors source was the BrowserRequest, which should be marked
 with the skin-type. if it was it should look up the adapter from the right
 layer. so i think something is wrong with my skin registration.
 
 could please somebody help me. i'm stuck with the problem. :(


I think I had the same problem while using z3c.form DisplayForm
subclass.
Problem disappeared by using an EditForm subclass and setting form's
mode to DISPLAY_MODE...

Thierry

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-14 Thread Thierry Florac
Hi,

I'm trying to use a few z3c.* packages to build a little test
application : z3c.form, z3c.formui, z3c.layout, z3c.pagelet...

What I've done until now is :
 - create a custom layer :
class ITestLayer(z3c.form.interfaces.IFormLayer,
 z3c.layer.pagelet.IPageletBrowserLayer)

 - create a custom skin based on this layer :
class ITestSkin(z3c.formui.interfaces.IDivFormLayer,
ITestLayer)

 - create a pagelet based layout for my skin (via z3c.layout)

 - create an add form, a display form and an edit form for my custom
content :
class TestAddForm(z3c.formui.form.AddForm)
class TestDisplayForm(z3c.formui.form.DisplayForm)
class TestEditForm(z3c.formui.form.EditForm)

 - declare these forms as pagelets (via z3c.pagelet)

Until now, everything is OK : I've created a set of custom widgets that
I can display without any problem in the different modes, and these
forms work perfectly.

My problem is that I would like to modify the default form template,
actually provided by z3c.formui template 'div-form.pt' ; so I've created
a new template, but I can't use it : I've tried to register it via
several ZCML directives (z3c.template...), but none of them is OK and my
custom template is never used !

So I just suppose that it's my ZCML directive which is bad, that I
missed a set of declarations (I didn't declare any macro, for example),
or just that the interface for which the template is registered is not
the good one...

Thanks for any help,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with z3c.form / z3c.formui packages

2008-03-14 Thread Thierry Florac
Hi,

On ven, 2008-03-14 at 23:12 +0100, Thierry Florac wrote:
 I'm trying to use a few z3c.* packages to build a little test
 application : z3c.form, z3c.formui, z3c.layout, z3c.pagelet...
 
 What I've done until now is :
  - create a custom layer :
 class ITestLayer(z3c.form.interfaces.IFormLayer,
  z3c.layer.pagelet.IPageletBrowserLayer)
 
  - create a custom skin based on this layer :
 class ITestSkin(z3c.formui.interfaces.IDivFormLayer,
 ITestLayer)
 
  - create a pagelet based layout for my skin (via z3c.layout)
 
  - create an add form, a display form and an edit form for my custom
 content :
 class TestAddForm(z3c.formui.form.AddForm)
 class TestDisplayForm(z3c.formui.form.DisplayForm)
 class TestEditForm(z3c.formui.form.EditForm)
 
  - declare these forms as pagelets (via z3c.pagelet)
 
 Until now, everything is OK : I've created a set of custom widgets that
 I can display without any problem in the different modes, and these
 forms work perfectly.
 
 My problem is that I would like to modify the default form template,
 actually provided by z3c.formui template 'div-form.pt' ; so I've created
 a new template, but I can't use it : I've tried to register it via
 several ZCML directives (z3c.template...), but none of them is OK and my
 custom template is never used !

I'm replying to my own message after a short discussion on IRC with
Stephan Richter, for anybody which would be interested in the answer...

The problem is coming from the ITestSkin interface, which was inheriting
from IDivFormLayer : actually, IDivFormLayer benefit is to provide a
ready to use div-based form layout ; so if your goal (like for me in
this example) is just to override this layout template, inheriting from
IDivFormLayer doesn't make any sense.

Problem was finally solved with the following statements :

class ITestSkin(z3c.formui.interfaces.IFormUILayer,ITestLayer):
...

z3c:template
for=z3c.form.interfaces.IInputForm
template=mydiv-form.pt
layer=.ITestLayer /


Many thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Dynamic interfaces ?

2008-03-10 Thread Thierry Florac
Hi,

I'm looking for a way to handle what I've called dynamic interfaces.
My problem is quite simple : I have an application where an
administrator can define content types ; for each content type, a set
of common predefined attributes are used, but the administrator can
define for each content type a set of custom attributes, each attribute
being defined by a name, a datatype (text, textline, date, boolean...)
and eventually a list of references values (for choices) ; definition of
these custom attributes is persistent and stored in the ZODB.
When creating data, contributor can select the data type, according to
which the matching set of attributes will be available in forms.

The main point is probably that I'd like to use z3c.form package as
usual, and so integrate this attributes management into Zope3
interfaces machinery... ; I suppose I should need a king of interface
factory, but couldn't find any link about that.

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] UnpickleableError when adding object with reference

2008-01-15 Thread Thierry Florac
Le mardi 15 janvier 2008 à 07:05 -0500, john saponara a écrit :
 I add a Limoservice object, then inside that object add a Car; then I 
 add a Driver (which contains a Car), and the AddForm offers a dropdown 
 with '(no value)' and my Car object.  If I select the car from the 
 dropdown I get an error:
 
 UnpickleableError: Cannot pickle type 'zope.security._proxy._Proxy' 
 objects
 
 Whereas if I leave the dropdown at '(no value)', the error does not 
 occur.  What am I doing wrong?  (See attached error.txt for full error.)

Hi, 
As explained into error message, you can't store security proxied
objects into ZODB : you have to remove proxy before they can be stored.

What I generally do is just something like this :

  ...
  from zope.security.proxy import removeSecurityProxy

  class Driver(Contained):
implements(IDriver,ILimoserviceContained)
_car = None

def _getCar(self):
  return self._car

def _setCar(self, value):
  self._car = removeSecurityProxy(value)

car = property(_getCar,_setCar)
  ...

Like that, any way the car property is modified, it's automatically
unproxied and can be stored safely.


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Object-deleted-events

2008-01-07 Thread Thierry Florac
Le lundi 07 janvier 2008 à 14:30 +0100, Tobias Rodäbel a écrit :
 Hi,
 
 I'd like to implement an event to be fired when an InternalPrincipal  
 shall be deleted from a PrincipalFolder.
 
 class IObjectShallBeDeletedEvent(IObjectEvent):
   Event, when an object will be deleted.
   
 
 class ObjectShallBeDeletedEvent(object):
   Event, when an object will be deleted.
   
   implements(IObjectDeletedEvent)
 
   def __init__(self, obj):
   self.object = obj
 
 class MyPrincipal(InternalPrincipal):
   def __del__(self):
   notify(ObjectShallBeDeletedEvent(self))
   super(MyObject, self).__del__()
 
 Because of some reason my event will not be fired. Did I miss something?
 
 For now I implemented this by subclassing PrincipalFolder and adding  
 my notify call to the __delitem__ method. That works well. But I would  
 prefer an implementation like drafted above.


  Hi,

Maybe I'm wrong, but I thing that '__del__' destructor is not called
when an object is removed from it's container, but when it's references
count in Python interpretor is decremented to 0.

For your use case, the only thing you should do is just to implement a
subscriber to IObjectRemovedEvent (defined into
zope.app.container.interfaces) which is automatically fired by all
standard Zope3 containers.

Hope this helps,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to persist an attribute of list type

2007-11-30 Thread Thierry Florac
Le samedi 01 décembre 2007 à 02:34 +0800, Yuan HOng a écrit :
 Hi,
 
 It seems that I can not get list attribute of an persistent object
 changed. I have the following class, which has a list as one of its
 attributes:
 
 class Cart(Persistent):
 items = []
 amount = 0
 
 In the debug console, I find that only with direct attribute
 assignment can I change the persisted attribute value. If I use
 items.append to modify the list, even after I set the _p_changed
 attribute of the cart object to True and commit, the persisted version
 won't change.
 
 I also tried to use PersistentList as the type of the 'items'
 attribute. It doesn't work either with append.
 
 What could be missing? I am using Zope 3.4.

You just have to use persistent lists :

  from persistent.list import PersistentList
  
  class Cart(Persistent):
items = PersistentList()
amount = 0

Persistent list are then handled as normal Python lists.

  Thierry


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Zope3, ZEO and RAMCache

2007-11-22 Thread Thierry Florac

  Hi,

I have a simple question : I'm using RAMCache with ZEO and several Zope
frontends ; when calling cache.invalidate(), are the selected entries
invalidated only on the Zope frontend which handled the request, or are
they invalidated on each frontend ??

Thanks for any information,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3, ZEO and RAMCache

2007-11-22 Thread Thierry Florac
Le jeudi 22 novembre 2007 à 14:46 +, Chris Withers a écrit :
 Thierry Florac wrote:
Hi,
  
  I have a simple question : I'm using RAMCache 
 
 What's RAMCache?

I'm just talking about the RAMCache utility, which is defined into
zope.app.cache package...


  with ZEO and several Zope
  frontends ; when calling cache.invalidate(), are the selected entries
  invalidated only on the Zope frontend which handled the request, or are
  they invalidated on each frontend ??
 
 if the invalidation finds its way back to ZEO, all clients will be 
 invalidated...

As it's name implies, RAMCache utility only stores it's data in RAM. So
I guess that ZODB won't be impacted by cache updates, as other Zope
frontends...
So what do you mean by find it's way back to ZEO ? And how can you
handle this ??

Thanks for any advise,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Installing Twisted with ZopeProject

2007-11-20 Thread Thierry Florac
Hi,

Until now, I was using Zope (3.3) installed from source (on Linux)
without problem.
Actually, I'm trying to discover ZopeProject and other eggs based
distributed packages, which seems to become the default (only ?)
distribution mode for future releases of Zope3.

My problem is simple : I'm currently using the scheduler package,
which is using the Twisted framework to handle tasks scheduling. But the
Twisted package is not provided anymore via ZopeProject as it was with
previous Zope3 big package. So :
 - I've installed VirtualEnv
 - I've installed ZopeProject into it, created and launched a new
application and everything was OK
 - I've tried to add twisted in setup.py file generated by
ZopeProject ; but it seems that the package can't be installed via
SetupTools. Should I install it by hand, use twisted package provided
by Zope3 or can I use python-twisted packages provided by Debian ?
 - when Twisted is installed, how can I setup my ZopeProject application
so that Twisted web server is used instead of default ZDaemon ?

For my own information, could anyone also tell me what are the benefits
of the different web servers that can be used with Zope3 (Twisted,
ZDaemon...) ??

Thanks,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Weird error for a certain named attribute

2007-10-23 Thread Thierry Florac

Le mardi 23 octobre 2007 à 14:11 +0200, Maken Seteva a écrit :
 Btw, is there an already existing way to index a field with a list of  
 strings so you can do a search on a particular element in the list? It's 
a little cumbrsome writing an adapter for each
 field that has a list of strings to join them as one string (if this  
 is even a good solution at all, I'm not sure).


Just have a look at SetIndex component ; I think it's included into
zc.catalog SVN package.

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zmi in zope 3.3.1

2007-08-28 Thread Thierry Florac
Le lundi 27 août 2007 à 15:22 -0700, Roman Budzianowski a écrit :
 Hi,
 
 
 I am following the book by Philipp von Weitershausen (2005) using an
 installation of zope 3.31 on Linux.
 I cannot locate in the zmi the interface browser shown on page 58.
 There are other tabs shown there like Tasks and Services.
 I don't see them either.
 
 
 Is my installation incorrect, or all of this has been removed since
 the book publication? Thanks for help.

Hi,

You probably have the first edition of Philipp's book, which describes
Zope X3, an old release of Zope.
Many changes have occured since this release ; you may get the second
(excellent !) edition of his book, published in 2007, which is based on
Zope-3.3.

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] hurry.workflow - retrieve item's history with timestamps of states transitions

2007-07-31 Thread Thierry Florac
Le mardi 31 juillet 2007 à 11:25 +, Alek Kowalczyk a écrit :
 Hello,
 I would like to have an ability to get 'workflow history' for my object. 
 History
 should contain a list of transitions with from and to states and with
 timestamps.
 
 Have anyone tried to implement such a simple functionality in hurry.workflow,
 similar to what ClearQuest does? I would be grateful for suggestions how to 
 deal
 with this. Maybe I've missed something while reading hurry.workflow docs, and 
 it
 is already available?


Hi,

I implemented such a functionality by adding a listener on
IWorkflowTransitionEvent, which with the help of zc.comment package add
comments with source and destination states labels, as well as a few
user comments ; these comments are prefixed by special characters so
that I can (when needed) filter them easilly, but implementing another
cleaner adapter to handle this should be very easy.

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3 PID file ?

2007-07-17 Thread Thierry Florac
Tuesday, July 17, 2007, 11:17:50 AM, you wrote:
 
 TF   Hi,
 
 TF I need to write scripts to handle Zope3 logfiles rotation.
 TF But I can't find any PID file for the running instance.
 TF Do I have to call for Zope restart or is there any other way which
 could
 TF avoid restarting Zope and flushing all caches ?


Le mardi 17 juillet 2007 à 11:48 +0200, Adam Groszer a écrit :

 What about zopectl logreopen?
 

zopectl logreopen works, but it seems that a SIGUSR2 signal is sent
and that the whole Zope process is respawned.
So I don't see any difference with zopectl restart... :-(

Am I wrong ?

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope3 PID file ?

2007-07-17 Thread Thierry Florac
Le mardi 17 juillet 2007 à 12:23 +0200, Martijn Pieters a écrit :
 On 7/17/07, Thierry Florac [EMAIL PROTECTED] wrote:
   What about zopectl logreopen?
  
 
  zopectl logreopen works, but it seems that a SIGUSR2 signal is sent
  and that the whole Zope process is respawned.
  So I don't see any difference with zopectl restart... :-(
 
  Am I wrong ?
 
 You are. There is a SIGUSR2 handler in Signals.Signals, which calls
 the 'reopen' method on all active loggers..
 
 Nowhere is there a signal handler that restarts Zope on SIGUSR2.
 SIGHUP will cause a restart, SIGINT a shutdown, and SIGTERM a fast
 shutdown.
 

My comment was just based on what I can see in z3.log after running
zopectl logreopen :

--
2007-07-17T14:19:42 INFO ZEO.ClientStorage (14916) ClientStorage
(pid=14916) created RW/normal for storage: 'www'
--
2007-07-17T14:19:42 INFO ZEO.cache reusing persistent cache file
'/var/local/zope/zeo1-www.zec'
--
2007-07-17T14:19:46 INFO ZEO.ClientStorage (14916) Testing connection
ManagedClientConnection ('127.0.0.1', 8100)
--
2007-07-17T14:19:46 INFO ZEO.zrpc.Connection(C) (localhost:8100)
received handshake 'Z303'
--
2007-07-17T14:19:46 INFO ZEO.ClientStorage (14916) Server authentication
protocol None
--
2007-07-17T14:19:46 INFO ZEO.ClientStorage (14916) Connected to storage:
('localhost', 8100)
--
2007-07-17T14:19:46 INFO ZEO.ClientStorage (14916) No verification
necessary (last_inval_tid up-to-date)
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) ClientStorage
(pid=14916) created RW/normal for storage: 'www'
--
2007-07-17T14:19:47 INFO ZEO.cache created temporary cache file
'fdopen'
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) Testing connection
ManagedClientConnection ('127.0.0.1', 8100)
--
2007-07-17T14:19:47 INFO ZEO.zrpc.Connection(C) (localhost:8100)
received handshake 'Z303'
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) Server authentication
protocol None
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) Connected to storage:
('localhost', 8100)
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) Verifying cache
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) endVerify finishing
--
2007-07-17T14:19:47 INFO ZEO.ClientStorage (14916) endVerify finished
--
2007-07-17T14:19:47 INFO root -- HTTP:localhost:8080 Server started.
Hostname: localhost
Port: 8080
--
2007-07-17T14:19:47 INFO root Startup time: 22.791 sec real, 17.310 sec
CPU


This output is just the same as what I can read when starting Zope.
Also, as you can see, I'm using a ZEO client storage and Twisted web
server ; I only found logreopen and SIGUSR2 references in ZDaemon
source code, and I thought that default server for Zope-3.3.1 was
Twisted...

Thanks (as always) for any complement...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] z3c.zalchemy / z3c.sqlalchemy

2007-07-17 Thread Thierry Florac

  Hi,

I'm looking for packages to ease integration of SQLAlchemy and Zope3.
I found the two references listed into this message's subject and was
wondering if there was any link between then, if both of them are
up-to-date and actively maintained, and what where the benefits of using
any or both of them...

Thanks for any information.

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] View or content provider

2007-07-11 Thread Thierry Florac
Hi,

I need very basic content providers to generate HTML contents from a set
of classes, inside pages templates.
Is there a huge difference between using views (and context/@@viewname
syntax) and using content providers (with provider:providername
syntax), mainly in terms of performances, CPU usage and/or memory
usage ??

Thanks for any advise for this simple problem, as both methods work
perfectly...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Custom Schemas, form widgets

2007-07-03 Thread Thierry Florac
Le mardi 03 juillet 2007 à 13:32 +0200, Hermann Himmelbauer a écrit :
 There are several missing schemas that derive from a TextLine but have custom 
 validation methods, e.g. for URLs, for an email address etc. Moreover there 
 are several widgets missing, e.g. a select widget for date/datetime fields.

Hi,

I currently use zc.datetimewidget package for date/time inputs. It's
available throught SVN, and works very well (currently with formlib for
me).

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Using RAMCache

2007-07-03 Thread Thierry Florac
Le mardi 03 juillet 2007 à 13:47 +0200, Dominique Lederer a écrit :
 hi
 
 i would like to cache the results of method in a view, and thougt, that 
 RAMCache
 could be of use here.
 
 After spending a lot of time searching for some documentation or examples, i
 came to this:
 
 from zope.app.cache.ram import RAMCache
 cache = RAMCache()
 query = cache.query('test',key={'x':1})
 if query == None:
   result = expensive_stuff_method()
   cache.set(result, 'test', key={'x':1})
   return result
 else:
   return query
 
 but that won´t work, the cache looses it´s entry, if i call the browser-view 
 again.

First of all, I thing that you can implement a RAM cache manager as a
utility into your site, and then just get to it via
zapi.queryUtility('IRAMCache').
But I didn't use RAM cache until now so I'm not sure if everything is OK
with them...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Getting view result from Python

2007-06-28 Thread Thierry Florac
Le mercredi 27 juin 2007 à 20:17 +0300, Marius Gedminas a écrit :
 On Wed, Jun 27, 2007 at 04:59:07PM +0200, Thierry Florac wrote:
  Le mercredi 27 juin 2007 à 14:31 +0200, Christophe Combelles a écrit :
   Thierry Florac a écrit :
I'd like to get a view output from some Python code.

Actually, I don't have any problem if I use a page template with a
simple tal:x content=structure context/@@viewname / expression and
return self.template() in Python.
But it should certainly be cleaner and less expensive to get view
output directly from Python code, which I don't actually manage to do...
   
   It depends on what you call a view,
   if this is a BrowserPage, you have a __call__ method that returns the 
   output.
   so just call your view().
   If this is a BrowserView, there is no __call__ because a BrowserView is 
   not 
   intended to be published as is. But you can have any method that returns 
   HTML.
 
 If you use getMultiAdapter to get the view, all these differences are
 hidden and you can call the view to get its output.
 
   If this is a Viewlet or a ContentProvider, there is a render method that 
   returns 
   the output. (provided you first call the update method)
 
 Then it's not really a view, is it?  ;-)
 
  In fact it's a little bit more complicated...
  What I have at first is a BrowserPage view, which is generally called
  from a page template with context/@@viewname syntax, without any
  problem.
  
  But I need also to be able to get the same view output from a JSON call,
  so that I can update a little bit of HTML code dynamically. I don't have
  any problem when defining a template with the same syntax. But if I call
  in python :
  
view = zapi.getMultiAdapter((myContext,myRequest), Interface,
name=u'viewname')
 
 This should work.  You don't have to pass Interface explicitly, by the
 way, view = getMultiAdapter((context, request), name='...') will work as
 well.
 
  I receive an error message :
  
__init__() takes at least 3 arguments (1 given)
 
 I don't believe you :-)
 
 Can you show the full traceback?  getMultiAdapter definitely passes the
 context tuple to the adapter's __init__.  There must be some other piece
 of code that fails for you.
 
  So zapi.getMultiAdapter creates the view, but how can I initialize it
  with it's required parameters (context and request) ?
 
 getMultiAdapter does that.  I speak from personal experience.

Whoops !
I'm really sorry but I think I made a stupid mistake in my
zapi.getMultiAdapter() call, because I used a custom request as
parameter instead of the initial request I received in my JSON
MethodPublisher subclass ; that's probably because of several tests I
made to get things working as I need... :-(

Really sorry again, but now it works perfectly...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Getting view result from Python

2007-06-27 Thread Thierry Florac

  Hi,

I'd like to get a view output from some Python code.

Actually, I don't have any problem if I use a page template with a
simple tal:x content=structure context/@@viewname / expression and
return self.template() in Python.
But it should certainly be cleaner and less expensive to get view
output directly from Python code, which I don't actually manage to do...

So any advise to this probably simple problem would be welcome.

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Getting view result from Python

2007-06-27 Thread Thierry Florac
Le mercredi 27 juin 2007 à 14:31 +0200, Christophe Combelles a écrit :
 Thierry Florac a écrit :
Hi,
  
  I'd like to get a view output from some Python code.
  
  Actually, I don't have any problem if I use a page template with a
  simple tal:x content=structure context/@@viewname / expression and
  return self.template() in Python.
  But it should certainly be cleaner and less expensive to get view
  output directly from Python code, which I don't actually manage to do...
  
  So any advise to this probably simple problem would be welcome.
 
 It depends on what you call a view,
 if this is a BrowserPage, you have a __call__ method that returns the output.
 so just call your view().
 If this is a BrowserView, there is no __call__ because a BrowserView is not 
 intended to be published as is. But you can have any method that returns HTML.
 If this is a Viewlet or a ContentProvider, there is a render method that 
 returns 
 the output. (provided you first call the update method)

In fact it's a little bit more complicated...
What I have at first is a BrowserPage view, which is generally called
from a page template with context/@@viewname syntax, without any
problem.

But I need also to be able to get the same view output from a JSON call,
so that I can update a little bit of HTML code dynamically. I don't have
any problem when defining a template with the same syntax. But if I call
in python :

  view = zapi.getMultiAdapter((myContext,myRequest), Interface,
  name=u'viewname')

I receive an error message :

  __init__() takes at least 3 arguments (1 given)

So zapi.getMultiAdapter creates the view, but how can I initialize it
with it's required parameters (context and request) ?

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Zope3 profiler ?

2007-06-12 Thread Thierry Florac
Hi,

I'm looking for a simple solution to profile a Zope3 application, some
kind of 'ZopeProfiler' product which was available for Zope2.

Any link or advise would be welcome...

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] zope.conf options

2007-05-28 Thread Thierry Florac
Hi,

I'm looking for the set of parameters that can be used in zope.conf
file, including those relatives to ZODB caching options and ZEO
configuration.
Any link would be greatly welcome...

Thanks for any help,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Small skinning question...

2007-05-10 Thread Thierry Florac

  Hi,

I'm building a new application with Zope3.
In this application, I can use several skins :
 - for all back-office and management pages, a single skin is used ;
it's defined via an Apache rewrite rule on a specific virtual host
 - for front-office pages, the applied skin can be chosen by each
subsite administrator between a set of skins made available to him.

My idea is to use the IBeforeTraverseEvent on the site container,
and to apply the selected skin when I'm on a front-office page.
So my question is simple : can I know easilly (without hardcoding
virtual hosts, in fact) if I'm on a back-office page or not and, in
fact, if a specific skin has already been applied ?

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Getting values of catalog index in a given context ?

2007-05-02 Thread Thierry Florac

  Hi,

I'm using Zope3 catalog (with it's zc.catalog extensions and indexes).
What I'd like is to get a list of indexed values for a given index but
in a given context ; for that, I have :
 - a SetIndex which indexes content's path elements
 - a ValueIndex which indexes the content property that I'm looking for.

The SetIndex allows me to easilly find contents which are located in a
given subpath ; but is there a way to get distinct values of the
ValueIndex for these contents, without iterating over them explicitly
(because contents count can be quite huge !) ?

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Single formlib widget for several fields

2007-04-20 Thread Thierry Florac

  Hi,

I'd like to create a custom formlib widget which could handle several
fields at once ; for example, I'd like a set of fields like month and
year to be handled in a single widget which could display two
combo-boxes.

Do I have to join these fields in a single interface, for which I can
create and declare a custom widget, or can I handle such things without
modifying my current interface (which I'd prefer).

Thanks for any advise,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ZEO security examples

2007-04-13 Thread Thierry Florac

  Hi,

Maybe I'm wrong, but it seems that ZEO protocol is, by default,
unauthenticated.
I've read here and there a few references to an authentication mechanism
which could be setup in ZOPE/ZEO, but can't find any valuable
implementation example for Zope3.
So, any link to define this for Zope3 would be very nice.

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
[EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] boolean value of adapted objects

2007-04-03 Thread Thierry Florac

  Hi,

I have a little question about boolean values of adapted objects.
For example, I had the following code :

info = ISharedDataInfo(context, None) or \
   IPrivateDataInfo(context, None)
if info is not None:
return context
return None

Even if context is correctly adapted to the first interface, the
boolean value matching the adapted object is not always True ; in these
cases, the second test is done, and the global result is set to None
instead of context.

Of course, it's easy to modify this code with two tests instead of one,
but I'm sure there's an easy way to handle such things, so any
information would be really great !!

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Formlib and custom validation constraints

2007-03-19 Thread Thierry Florac

  Hi,

I'm having a few problem(s) with Zope3's formlib package.
Actually, I've defined a 'Bytes' property to store an external file
which is sometimes required, sometimes not, depending on a set of
current context values.
The interface field is actually defined as required=False, which is
the more current case ; when field is required, setting
self.widgets['myfield'] is enough in setUpWidgets to display the
field as mandatory, but not to let this constraint to be checked.

So my question is simple : how do I have to handle such custom
constraints, which are applied to only one field and which I don't want
to define via invariants (because I'd like the error message to be
displayed correctly next to the required widget) ?
Until now I've tried a few methods (via widget._error property for
example) not nothing gave me correct results...

Thanks for any help,

  Thierry Florac

P.S. : I currently use Zope-3.3.1


-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Internationalisation of a viewlet property

2007-03-06 Thread Thierry Florac
Hi,

I've created a custom viewlet to display a menu entries with the
following declaration :

viewlet
name=onf.bo.actions
for=*
manager=.ActionsManager
class=.ActionsViewlet
permission=zope.View
layer=onf.skin.bo.OnfSkin
label=Actions
menu=zmi_views
order=10
back_to_upper=True /

My problem is simple : how can I get the label property to be
correctly included by the I18n extraction machinery in my gettext .pot
file ?

Thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question about IOrderedContainer interface

2007-02-27 Thread Thierry Florac
Le lundi 26 février 2007 à 19:39 +0200, Marius Gedminas a écrit :
 On Mon, Feb 26, 2007 at 05:28:12PM +0100, Thierry Florac wrote:
  I have a little question about the IOrderedContainer interface.
  
  Actually, this interface is derived from IContainer, and only contains
  a single method, updateOrder() which is an updating method.
  
  When I create a subclass of OrderedContainer for which I'd like only a
  limited set of roles to have reordering permission,
 ...
  So I can see only three ways to make this working :
 ...
   - wait for someone else to give me another solution, which wouldn't
  need to modify Zope source code :-)
 
 require
   interface=IReadContainer
   permission=zope.View /
 require
   interface=IWriteContainer
   permission=zope.ManageContent /
 require
   attributes=updateOrder
   permission=zope.ManageContent /

I agree with you that I can use this workaround.
But is it really fine to define a writing interface as a sub-interface
of IReadContainer which, as said before, just need reading
permissions ??
Using attributes here in ZCML is only OK because we have a single
method in IOrderedContainer interface...

Thanks anyway,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Question about IOrderedContainer interface

2007-02-26 Thread Thierry Florac

  Hi,

I have a little question about the IOrderedContainer interface.

Actually, this interface is derived from IContainer, and only contains
a single method, updateOrder() which is an updating method.

When I create a subclass of OrderedContainer for which I'd like only a
limited set of roles to have reordering permission, I'd like to do
something like :

  require
interface=IReadContainer
permission=zope.View /
  require
interface=IOrderedContainer
permission=zope.ManageContent /

But this doesn't work, because of a ConfigurationConflictError.

So I can see only three ways to make this working :
 - make IOrderedContainer derived from IWriteContainer instead of
IContainer (what I've done until now !)
 - make IOrderedContainer a separate interface, so that I could do
something like :

  require
interface=IReadContainer
permission=zope.View /
  require
interface=IWriteContainer
permission=zope.ManageContent /
  require
interface=IOrderedContainer
permission=zope.ManageContent /

 - wait for someone else to give me another solution, which wouldn't
need to modify Zope source code :-)

Thanks for any help or advise,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Problem with zc.table content internationalization

2007-01-30 Thread Thierry Florac
  Hi,

I currently have a little problem to translate contents displayed in a
zc.table component.
Here is an extract of my Python code :


from onf import _

DRAFT  =  0  # New document
PROPOSED   =  1  # Publication request
CANCELED   =  2  # Publication request canceled
REFUSED=  3  # Publication request refused
PUBLISHED  =  4  # Publication approved

StateLabels = { 
DRAFT : _(status-draft,Draft),
PROPOSED  : _(status-proposed,Publication request),
CANCELED  : _(status-canceled,Canceled publication
request),
REFUSED   : _(status-refused,Refused publication
request),
PUBLISHED : _(status-published,Published)
}

class EventManagerSearchForm(BaseForm):
...
columns = (...
  SortableColumn(_('status','Status'),
lambda c,f:
StateLabels.get(IWorkflowState(c).getState())),
   ...)

@Lazy
def formatter(self):
return Formatter(self.context, self.request,
 self.values(),columns=self.columns)


ZPT is as simple :

html i18n:domain=onf
...
table tal:replace=structure view/formatter /
...
/html


My problem is that the StateLabels are translated correctly in several
templates, but not when used inside this table (I can only see the
status-... translation key in generated output).
So any help or advise would be very helpful...

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Security related questions

2007-01-17 Thread Thierry Florac
Le mercredi 17 janvier 2007 à 11:06 +0100, FB a écrit :
 Hi,
 
 On Tue, Jan 16, 2007 at 01:15:53PM -0500, Stephan Richter wrote:
  On Tuesday 16 January 2007 12:39, FB wrote:
   is there a way to get all the permissions and roles, the current principal
   is associated to for a given object?
  
   Something like:
  
getAllRoles(context)
getAllPermissions(context)
  
  No. You would have to write your own code doing that. Note that it really 
  depends on the security policy on what roles and permissions are available.
 
 My securitypolicy is z.a.securitypolicy :-) .

Hi,

I've written my own adapter to get the list of roles granted or denied
for a given principal, and the list of principals granted or denied for
a given role, always in the context of the adapted object ; you'll find
the source code into joined files, just having to configure it :

adapter
factory=.manager.SecurityManager
provides=.interfaces.ISecurityManager
for=zope.annotation.interfaces.IAnnotatable
trusted=true /

class class=.manager.SecurityManager
allow
interface=.interfaces.ISecurityManager /
/class

I'm far from sure if this is the best approach, but at list it works for
my own needs in the context of zope.app.securitypolicy.
Writing the same adapter to get the list of permissions (by iterating
throught the list of granted or denied roles and using the
IRolePermissionManager interface) shouldn't be too difficult...

Hope this will help you,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85
# Copyright (C) ONF 2006 by Thierry Florac





__version__   = $Revision: $
__release__   = $Id: $
__docformat__ = 'restructuredtext'


# import Zope3 interfaces
from zope.interface import Interface

# import local interfaces

# import Zope3 packages

# import local packages

from ulthar import _


class ISecurityManager(Interface):
This facility class is used to access roles and permissions on a given object for current interaction

def getLocalRoles(principal=None):
Get principal allowed and denied roles on current object

Result is given as a dictionary :
{ 'allow': ['role1','role2'], 'deny': ['role3',] }


def getLocalAllowedRoles(principal=None):
Get list of locally allowed roles

def getLocalDeniedRoles(principal=None):
Get list of locally denied roles

def getRoles(principal=None):
Get list of roles, including inherited ones

Result is given as a dictionary :
{ 'allow': ['role1','role2'], 'deny': ['role3',] }


def getAllowedRoles(principal=None):
Get list of allowed roles, including inherited ones

def getDeniedRoles(principal=None):
Get list of denied roles, including inherited ones

def getLocalPrincipals(roleId):
Get list of principals with locally defined role

Result is given as a dictionary :
{ 'allow': ['principal1','principal2'], 'deny': ['principal3',] }


def getLocalAllowedPrincipals(roleId):
Get list of principals with locally granted role

def getLocalDeniedPrincipals(roleId):
Get list of principals with locally denied role

def getPrincipals(roleId):
Get list of principals with access defined for allowed role, including inherited ones

Result is given as a dictionary :
{ 'allow': ['principal1','principal2'], 'deny': ['principal3',] }


def getAllowedPrincipals(roleId):
Get list of principals with granted access to specified role, including inherited ones

def getDeniedPrincipals(roleId):
Get list of principals with denied access to specified role, including inherited ones

def canUseRole(roleId, principal=None):
Return true or false to specify role usage for given principal

def canUsePermission(permission, principal=None):
Return true or false to specify permission usage for given principal

def canView(principal=None):
Return true or false if 'zope.View' permission is granted to given principal
# Copyright (C) ONF 2006 by Thierry Florac





__version__   = $Revision: $
__release__   = $Id: $
__docformat__ = 'restructuredtext'


# import Zope3 interfaces
from zope.interface import implements
from zope.publisher.interfaces import IRequest
from zope.security.interfaces import IPrincipal
from zope.app.securitypolicy.interfaces import IPrincipalRoleManager

# import local interfaces
from interfaces import ISecurityManager

# import Zope3 packages
from zope.app import zapi
from zope.security.management import checkPermission, getInteraction

# import local

[Zope3-Users] Content cloning ?

2007-01-15 Thread Thierry Florac

  Hi,

In an application I'm currently building with Zope3, I need to be able
to clone several kinds of content data.
While cloning a simple content class is quite simple, I don't know
exactly how to clone data provided through adapters, which may store
these data throught annotations.

What I was thinking about was something like :
 - create a new interface IClonable, with a single clone method
 - make my specific content interfaces, eventually provided throught
adapters, extend IClonable
 - get a list of interfaces provided by my content class, directly or
throught adapters, which extend IClonable, and call their clone method
when cloning is required.

So, actually, my main problem is : 
 - how can I get the list of interfaces provided by a given class,
directly of throught adapters ?
 - is this conception method the best one in Python/Zope3 to clone
data ??

Thanks for any help or advise...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Required choice without default value in formlib

2007-01-12 Thread Thierry Florac

  Hi,

I use formlib to handle my forms.
In a AddForm, how can I have a required choice property, using a dynamic
vocabulary, without a default selected value ?

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Periodically refresh RSS feeds

2006-12-19 Thread Thierry Florac
Le mardi 19 décembre 2006 à 08:17 +0100, Christian Theune a écrit :
 Hi,
 
 Florian Lindner wrote:
  Hello,
  I have the following situation:
  
  An object represents an RSS feed. It should be updated like every 20 
  minutes. 
  If there is something new a Jabber message should be send out.
  
  Currently I have it implemented with an scheduler loop that emits an 
  refreshRSSFeed event evey 20 minutes. My problem is that a handler for an 
  event must be a static function, but I want a handler function to be called 
  as a member of every instantiated RSS feed object.
  
  Another idea I have:
  Implement an utility where the RSS feeds could register a function that is 
  called every 20 minutes.
  Another way would be that this utility takes an URL and monitors the URL 
  for 
  changes and only notifies the RSS Feed object in case of a change.
 
  How would you do that?
 
 So there's two problems here: scheduling and notifying persistent
 objects about an event.
 
 I don't have a good idea about the scheduling right now, except the hint
 that using a 'zopectl run' script might be worthwhile.  I'm not sure
 what a 'scheduler function is'.
 
 About notifying persistent objects: There is a method
 'getAllUtilitiesRegisteredFor(interface)' which might help you. Have a
 look at zope/app/catalog/catalog.py beginning from line 150
 (indexDocSubscriber) how the catalog handles events and dispatches them
 to multiple catalogs. I think this pretty much matches your use case if
 you make each RSS feed a (named) utility.
 
 Of course you could also have a utility that maintains references to all
 RSS feed objects and simply loops over them and calls a method for
 refreshing.


Hi,

I had a several problem to handle regular alerts which I solved in
this way :
 - scheduling in done via the schedule package, available from Zope3
SVN ; I created an AlertManager utility which is a subclass of
scheduler.CronTask (because my alerts are launched at fixed time, but
you can use other classes)
 - objects which can raise alerts are registered with a specific
interface IAlert
 - when the AlertManager is launched, it opens a new connection (via
ZEO.ClientStorage), search for registered components (via
zapi.getAllUtilitiesRegisteredFor(IAlert)) and call one of the
interface's methods which may raise the alert. In my use case an email
is sent, but it could be any kind of alert that Python can handle.

I'm far to know if this is the best approach, but at least it works
quite efficiently...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Database conflicts errors ?

2006-12-08 Thread Thierry Florac
Le vendredi 08 décembre 2006 à 15:08 +0100, Thierry Florac a écrit :
   Hi,
 
 I'm currently writing an image management adapter for Zope3.
 It's goal is just to create and store thumbnails on the fly when an
 image is requested with an additional specific traversal name (for
 example, myimage/thumbnail will create a thumbnail of a given
 predefined size, while myimage/200x200 will create a copy of the
 original image reduced to 200 pixels).
 These thumbnails are stored in the original image annotations.
 
 Everything seems to work fine, except for a little thing : I've created
 a specific widget so that, when an image is uploaded, a thumbnail of the
 new uploaded image is immediately displayed next to the data field
 upload button.
 But when the form is displayed, a DatabaseConflictError is visible
 into Zope's log, even if everything seems to work correctly from a
 browser's point of view.
 
 I'm not completely sure to understand what DatabaseConflictErrors are,
 so any explanation about this kind of problem would be greet.
 I'll just add for your information that I'm using ZEO...


Oops !!
Sorry, I found the source of my problem : it was a misconfiguration of
the adapter, who was writing data in it's context each time it was
called, even if the context was already adapted.

A small missing tab and conflicts are gone...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Scheduler package usage

2006-11-22 Thread Thierry Florac
Le mercredi 22 novembre 2006 à 08:12 +1100, Tom Dossis a écrit :
 Thierry Florac wrote:
   - as I use virtual hosting, my utilities are located and registered in
  a sub-site. How can I get access to these components in my scheduler
  tasks throught zapi functions, without knowing a priori their names or
  paths ?
 
 from zope.app.component import hooks
 hooks.setSite(mysite)
 
 This should make your utility lookups work.  Of course you still need a
 way to get your subsite 'mysite' object, whether you traverse from the
 root object, etc. is up to you.
 
 Finally, I'm not sure if you need to setup an interaction, which raises
 the question: what/who is the principal in within your scheduler context?

Many thanks : it seems to work perfectly !
The main solution was to know the hooks.setSite() method.
For the rest, I'm just using a ZEO ClientStorage connection to avoid
errors relatives to different database connections, and take a look at
the 'Application' values to find objects implementing a given required
interface (my own site manager interface), and everything is really fine
now...

Thanks again,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] how to access the root folder in normal operation

2006-11-17 Thread Thierry Florac
Le vendredi 17 novembre 2006 à 16:59 +0530, Shailesh Kumar a écrit :
 Hi, 
  
 zope.traversing.api.getRoot  returns the root of a given object. What
 I wanted to do was that when zope starts, I would like to create a few
 content objects inside the root folder. 
  
 Something like:
 root = getRootFolder() #using some way I don't know. 
 root['etc'] = Folder()
 root['var'] = Folder()
 ... 
  
 Is it possible to do that? 


I currently use something like this, to handle a site configuration on startup 
(define catalog indexes...) :

from zope.app.appsetup.interfaces import \
IDatabaseOpenedWithRootEvent
from zope.app.publication.zopepublication import ZopePublication
from zope.component import adapter

@adapter(IDatabaseOpenedWithRootEvent)
def handleDatabaseOpenedWithRootEvent(event):
db = event.database
connection = db.open()
root = connection.root()
root_folder = root.get(ZopePublication.root_name, None)
...

And in ZCML :

subscriber
handler=.handleDatabaseOpenedWithRootEvent /


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Needed help with zc.table selection column

2006-11-15 Thread Thierry Florac

  Hi,

I'm using zc.table to handle simple lists of items to replace the
standard contents.html container view.
I use a SelectionColumn and a set of sortable columns, to display a
checkbox in front of every item, and a set of custom actions to handle
my selections.
My question is trivial : as items names are base64 encoded into form
widgets and form data, is there an already defined way to easilly get
the list of selected keys, without decoding base64 input fields ?

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Handling deletion rights ?

2006-10-31 Thread Thierry Florac
Le lundi 30 octobre 2006 à 11:13 -0400, Stephan Richter a écrit :
 On Friday 06 October 2006 08:40, Thierry Florac wrote:
  I can easilly give access rights for managers and contributors so that
  each of them can only create given objects.
  But what concerning deletion ? How can I prevent a contributor from
  removing a sub-folder ?
 
 Good question. I think you have to try a different strategy. You have several 
 choices:
 
 - Implement two deletion methods, each with the right permission.
 - Implement views that work out the permissions manually.
 - Have separate folders for sub-folders and content.

Separating sub-folders and content is not appropriated in my own case.
At last, I think that I'll finally :
 - listen to ObjectDeletedEvent and raise an exception if the current
user doesn't have required roles, or...
 - replace the standard folders's contents.html view to remove the
Delete action, and provide this action through entries available in
sub-folders and content management screens

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with Python 2.4.4

2006-10-24 Thread Thierry Florac
Le mardi 24 octobre 2006 à 07:51 -0400, Jim Fulton a écrit :
 Torvald Bringsvor wrote:
  I guess this may be a Python problem rather than a
  zope problem, but I just thought I'd check here.
  
  I have set up Zope 3.3.0 with Python 2.4.4, and it
  didn't quite work. Some operations such as adding a
  content object provoked an error from cgi.py line 716,
  this line reads:
line = self.fp.readline(116)
  
  and then Python reacts that readline should have max
  one argument, but it gets two. By correcting it to
 line = self.fp.readline()
  
  everything works well.
  
  Have anybody else had this problem?
 
 You should report this in the Zope 3 collector,
 http://www.zope.org/Collectors/Zope3-dev.
 
 It looks like Zope's file stream object that it passes to
 the CGI module needs to grow a maximum size.

Hi,

I had the same problem on Debian GNU/Linux.
Problem is due to a security patch applied on cgi.py in Debian's
unstable release.


  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Synchronizing with a remote host

2006-10-24 Thread Thierry Florac

  Hi,

I need a few advises.
I'm building a new Zope3 site, including :
 - a 'back-office' server, containing all internal data handled by
contributors and administrators, including drafts, versioning,
workflows, publication, archiving...
 - a 'front-office' server, containing a selection of published data
available to the outside.

I need to be able to synchronize data from back-office to front-office,
so that :
 - all the maintenance is made on the back-office server
 - any published data is made available to the front-office
 - any retired data is deleted from the front-office immediately.

To handle such a task, I was thinking about using :
 - a ZEO server instance on the front-office server,
 - and a ZEO ClientStorage on the back-office to handle replication of
data to the front-office.

Of course, I'm far from sure if this is the best way to handle my
problem.
There may be several approachs (using XML-RPC ?) and as I'm not a great
ZODB or ZEO specialist, any advise would be greatly welcome.

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Custom DateWidget with Month/Day/Year

2006-10-18 Thread Thierry Florac
Le mardi 17 octobre 2006 à 13:46 +0200, FB a écrit :
 Hi,
 
 On Mon, Oct 16, 2006 at 05:46:29PM +0200, Thierry Florac wrote:
 
 [snip]
 
  Installation is fine, as well as widget, but I can't get dates displayed
  or entered in a french way (DD/MM/).
  I've tried to modify browser settings as well as a few parameters, but
  nothing is doing it correctly (and when date is displayed correctly in a
  form, Zope 'normally' says that dates are not correctly formatted while
  submitting !).
 
 Hmm ... it took me 10 seconds to change the format to DD/MM/Y.
 Have a look at datetimewidget.py, look for '_format' .

What I'd like in fact is to be able to display and enter dates in a
format following user's locale.
That doesn't seem to work or is not supported by current implementation
of zc.datetimewidget...

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ForbiddenAttribute problem with viewlet manager and hurry.workflow

2006-10-18 Thread Thierry Florac

  Hi,

I'm trying to use the hurry.workflow package (loaded from CVS) to
handle a simple workflow.
I've created a ViewletManager to display available transitions, but a
ForbiddenAttribute exception is raised. I know that this exception is
due to missing permissions settings, but no configuration is working...

This is the code of my viewlet manager :

class WorkflowTransitions(object):

implements(IContentProvider)
adapts(Interface, IDefaultBrowserLayer, Interface)

template = ViewPageTemplateFile('transitions.pt')

def __init__(self, context, request, view):
self.context = context
self.request = request
self.__parent__ = view

def update(self):
wf = zapi.queryUtility(IWorkflow)
if wf is not None:
info = IWorkflowInfo(self.context)
self._transitions = info.getManualTransitionsIds()
else:
self._transitions = []

@property
def transitions(self):
return self._transitions

def render(self, *args, **kw):
return self.template(self, *args, **kw)

I've tryed to define several security declarations in ZCML, but none is
working. The exception is raised while accessing
getManualTransitionIds() method :

  File .../onf/publication/browser/viewlets/transition/__init__.py, \
  line 45, in update
ids = info.getManualTransitionsIds()
  ForbiddenAttribute: ('getManualTransitionsIds', \
  hurry.workflow.workflow.WorkflowInfo object at 0xb4f5cd8c)

I've also tried to use a simple content provider with an adapter but got
the same result.

Thanks for any help,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ForbiddenAttribute problem with viewlet manager and hurry.workflow

2006-10-18 Thread Thierry Florac
Le mercredi 18 octobre 2006 à 13:31 +0200, Thierry Florac a écrit :
   Hi,
 
 I'm trying to use the hurry.workflow package (loaded from CVS) to
 handle a simple workflow.
 I've created a ViewletManager to display available transitions, but a
 ForbiddenAttribute exception is raised. I know that this exception is
 due to missing permissions settings, but no configuration is working...
 
 This is the code of my viewlet manager :
 
 class WorkflowTransitions(object):
 
 implements(IContentProvider)
 adapts(Interface, IDefaultBrowserLayer, Interface)
 
 template = ViewPageTemplateFile('transitions.pt')
 
 def __init__(self, context, request, view):
 self.context = context
 self.request = request
 self.__parent__ = view
 
 def update(self):
 wf = zapi.queryUtility(IWorkflow)
 if wf is not None:
 info = IWorkflowInfo(self.context)
 self._transitions = info.getManualTransitionsIds()
 else:
 self._transitions = []
 
 @property
 def transitions(self):
 return self._transitions
 
 def render(self, *args, **kw):
 return self.template(self, *args, **kw)
 
 I've tryed to define several security declarations in ZCML, but none is
 working. The exception is raised while accessing
 getManualTransitionIds() method :
 
   File .../onf/publication/browser/viewlets/transition/__init__.py, \
   line 45, in update
 ids = info.getManualTransitionsIds()
   ForbiddenAttribute: ('getManualTransitionsIds', \
   hurry.workflow.workflow.WorkflowInfo object at 0xb4f5cd8c)

Oops, Sorry !!
The error was a simple syntax error : correct method name is
getManualTransitionIds(), without the s.
But as said in a previous post, the ForbiddenAttribute exception is
strange in such a case...

Thanks,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Custom DateWidget with Month/Day/Year

2006-10-16 Thread Thierry Florac
Le lundi 16 octobre 2006 à 10:51 -0400, Fred Drake a écrit :
 On 10/16/06, Oliver Petznick [EMAIL PROTECTED] wrote:
  i'm trying to overwrite the DateWidget so the user can select day/
  month/year out of 3 dropdowns. my problem is that zope searches for
  'form.field' and not for 'form.field.day' and so on.. so i get the
  no input error..  how i can solve this? is there a method which i
  can overwrite?
 
 That's entirely a function of the widget itself.  Instead of hacking
 up the existing widget, you'll need to create an entirely new widget.
 
 Or, you might be interested in zc.datetimewidget, available in the
 Zope Subversion repository:
 
 http://svn.zope.org/zc.datetimewidget/trunk/
 
 This provides a JavaScript-based widget with a little calendar to pick
 dates from.  Both date and date/time variants are provided.

I've just tried to use zc.datetimewidget package in my Zope3
development installation.
Installation is fine, as well as widget, but I can't get dates displayed
or entered in a french way (DD/MM/).
I've tried to modify browser settings as well as a few parameters, but
nothing is doing it correctly (and when date is displayed correctly in a
form, Zope 'normally' says that dates are not correctly formatted while
submitting !).

Thanks for any help...

  Thierry Florac

P.S. : I also tried to install and configure z3c.language package.
Could there be any inter-dependance between these two packages ?

-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] ForbiddenAttribute on locate method

2006-10-11 Thread Thierry Florac




Le mercredi 11 octobre 2006  00:52 +0200, Thierry FLORAC a crit:


  Hi,

I try to setup a little application but have a probably little problem
with a ForbiddenAttribute exception on location.locate method.
Here is my setup :

class IPhoto(IContainer,IContained):
Photo handling interface
...
image = Bytes(...)
...

class Photo(Folder):
Photo handling class
...
image = None
def __init__(self, image=None):
super(Photo,self).__init__()
self.__parent__ = self.__name__ = None
if image:
self.image = image
...

class IEvent(IContained):
Event handling interface
...

class Event(Persistent):
Event handling class
...
def __init__(self):
super(Event,self).__init__()
self.__parent__ = self.__name__ = None

In my event creation form (derived from formlib.AddForm), I put
something like this, without a problem :

def create(self, data):
event = Event()
if data.has_key('image'):
event.image = Photo(image=data['image'])
location.locate(event.image, event, 'image')
form.applyChanges(event, self.form_fields, data)
return event

event.image access can then be granted easily in an URL through a
z3c.traverser plug-in and everything works fine... until now !
Because when I'm trying to make the same thing in an edit form to update
an existing event, an exception is raised :

def edit(self, action, data):
changed = False
event = self.context
if data.has_key('image'):
event.image = Photo(image=data['image'])
location.locate(event.image, event, 'image')
changed = True
return super(EventEditForm,self).edit(action, data) or
changed

Here is the traceback :

Traceback (most recent call last):
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 133, in publish
result = publication.callObject(request, obj)
  File /usr/local/zope/3.3.0/lib/python/zope/app/publication/zopepublication.py, line 161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 108, in mapply
return debug_call(obj, args)
   - __traceback_info__: security proxied zope.app.publisher.browser.viewmeta.NewsEventEditForm instance at 0xa677e20c
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 114, in debug_call
return obj(*args)
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 751, in __call__
self.update()
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 732, in update
result = action.success(data)
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 582, in success
return self.success_handler(self.form, self, data)
  File /var/local/zope/3.3/lib/python/ulthar/forms/forms.py, line 104, in handle_edit_action
self.edit_action(action,data)
  File /var/local/zope/3.3/lib/python/ulthar/forms/forms.py, line 107, in edit_action
if not self.edit(action, data):
  File /var/local/zope/3.3/lib/python/usf/news/browser/event.py, line 85, in edit
location.locate(event.image, event, 'image')
  File /usr/local/zope/3.3.0/lib/python/zope/location/location.py, line 71, in locate
object.__parent__ = parent
ForbiddenAttribute: ('__parent__', gallery.photo.Photo object at 0xa678f62c)



Hi,

I finally solved this stupid problem by myself...
Switching location.locate method call from EditForm view to Event class was just enough...




 Thierry Florac
-- 



 Chef de projet intranet/internet
 Office National des Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] ForbiddenAttribute on locate method

2006-10-10 Thread Thierry FLORAC

  Hi,

I try to setup a little application but have a probably little problem
with a ForbiddenAttribute exception on location.locate method.
Here is my setup :

class IPhoto(IContainer,IContained):
Photo handling interface
...
image = Bytes(...)
...

class Photo(Folder):
Photo handling class
...
image = None
def __init__(self, image=None):
super(Photo,self).__init__()
self.__parent__ = self.__name__ = None
if image:
self.image = image
...

class IEvent(IContained):
Event handling interface
...

class Event(Persistent):
Event handling class
...
def __init__(self):
super(Event,self).__init__()
self.__parent__ = self.__name__ = None

In my event creation form (derived from formlib.AddForm), I put
something like this, without a problem :

def create(self, data):
event = Event()
if data.has_key('image'):
event.image = Photo(image=data['image'])
location.locate(event.image, event, 'image')
form.applyChanges(event, self.form_fields, data)
return event

event.image access can then be granted easily in an URL through a
z3c.traverser plug-in and everything works fine... until now !
Because when I'm trying to make the same thing in an edit form to update
an existing event, an exception is raised :

def edit(self, action, data):
changed = False
event = self.context
if data.has_key('image'):
event.image = Photo(image=data['image'])
location.locate(event.image, event, 'image')
changed = True
return super(EventEditForm,self).edit(action, data) or
changed

Here is the traceback :

Traceback (most recent call last):
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 133, 
in publish
result = publication.callObject(request, obj)
  File 
/usr/local/zope/3.3.0/lib/python/zope/app/publication/zopepublication.py, 
line 161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 108, 
in mapply
return debug_call(obj, args)
   - __traceback_info__: security proxied 
zope.app.publisher.browser.viewmeta.NewsEventEditForm instance at 0xa677e20c
  File /usr/local/zope/3.3.0/lib/python/zope/publisher/publish.py, line 114, 
in debug_call
return obj(*args)
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 751, in 
__call__
self.update()
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 732, in 
update
result = action.success(data)
  File /usr/local/zope/3.3/lib/python/zope/formlib/form.py, line 582, in 
success
return self.success_handler(self.form, self, data)
  File /var/local/zope/3.3/lib/python/ulthar/forms/forms.py, line 104, in 
handle_edit_action
self.edit_action(action,data)
  File /var/local/zope/3.3/lib/python/ulthar/forms/forms.py, line 107, in 
edit_action
if not self.edit(action, data):
  File /var/local/zope/3.3/lib/python/usf/news/browser/event.py, line 85, in 
edit
location.locate(event.image, event, 'image')
  File /usr/local/zope/3.3.0/lib/python/zope/location/location.py, line 71, 
in locate
object.__parent__ = parent
ForbiddenAttribute: ('__parent__', gallery.photo.Photo object at 0xa678f62c)


I've tried to setup different permissions and access rights, but without 
success.
So any help would be great !

Thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Seeking a ZCML Example for a CSSViewlet

2006-10-09 Thread Thierry Florac




Le samedi 07 octobre 2006  17:00 +1300, Darryl Cousins a crit:


configure zcml::

  browser:viewlet
  name=layout.css
  for="">
  manager=barrysmithgallery.layer.public.ICSS
  permission=zope.Public
  class=..BRSPublicLayerLayoutCSSViewlet
  layer=barrysmithgallery.layer.public.IBRSPublicBrowserLayer
  weight=2
  /



Maybe I'm wrong, but it seems that the weight parameter is not used by the default implementation of the CSS viewlet manager...
Correct ?




 Thierry Florac
-- 



 Chef de projet intranet/internet
 Office National des Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Handling deletion rights ?

2006-10-06 Thread Thierry Florac





 Hi,

I have folders in my Zope3 application, which can contain sub-folders as well as content objects.
Sub-folders are handled by a manager.
Content objects are handled by contributors.

I can easilly give access rights for managers and contributors so that each of them can only create given objects.
But what concerning deletion ? How can I prevent a contributor from removing a sub-folder ?

Thanks for any help,




 Thierry Florac
-- 



 Chef de projet intranet/internet
 Office National des Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Search engine in Zope content component ?

2006-09-28 Thread Thierry Florac




Le jeudi 28 septembre 2006  09:31 +0200, KLEIN Stphane a crit:


how can I make one search engine on my content component ? I must use
regex in big loop on all content component data ?



You just have to setup a catalog (in zope.app.catalog) and a set of indexes corresponding with your search criterias
Take a look at zc.catalog from SVN to get access to a set of additionnal indexes, as well as TextIndexNG to get a complete full-text indexer.




 Thierry Florac
-- 



 Chef de projet intranet/internet
 Office National des Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Are there some French Zope user here ?

2006-09-22 Thread Thierry Florac
Le vendredi 22 septembre 2006 à 11:29 +0200, KLEIN Stéphane a écrit :
 Are there some French Zope user here ?
 
 If the number of french user is important, I propose the creation of
 zope-french-user and zope3-french-user mailing list.
 
 What do you think about this idea ?
 
 Regards,
 Stephane


  Hi,

I'm here :-) 
+1

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] 4 questions from a newcomer

2006-09-06 Thread Thierry Florac




Le mercredi 06 septembre 2006  06:54 -0400, Stephan Richter a crit:


On Tuesday 05 September 2006 11:10, Christophe Combelles wrote:
 2) utf-8 error in i18nfile
 --
 Why do I always get an error when I try to add some utf-8 text into an
 i18nfile? I just add an i18nfile in the ZMI, then I chose a name and I set
 the contentType to text/plain;charset=utf-8. If I enter some text with
 accents like , I get a system error which says : UnicodeDecodeError:
 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in
 range(128).
 I don't get any error with a simple File object.

Okay, I18n file is a demo that is probably not well-developed. Don't use it. I 
will propose to not distribute it anymore. Noone is using it, so you are on 
your own finding the problem and providing a patch.



I had the same problem in my french site where we use many accentuated characters.
The solution I use until now is just to switch my Python interpreter to use UTF-8 as default encoding, via the site.py file of my Python distribution...




 Thierry





___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] z3c.extfile and ZEO ?

2006-09-06 Thread Thierry FLORAC




On Wed, 2006-09-06 at 14:20 -0300, David Pratt wrote:


Thierry, you may want to consider blobs when they become generally 
available through zodb. It takes care of the management details for ZEO 
and files.



Is there any planned release date for this feature ?
Do you think that it could be included in the next stable release of Zope ??

Thanks for any information,
Thierry

P.S. : is there, in fact, any planned release date for the next stable release of Zope3 ? That can seem a stupid question, but I'm currently building a quite important web site with Zope3 (release 3.3.0b2) without any problem ; it's just quite difficult, on a political point of view, to convince managers that you are going to deploy your application with a Beta version of your application server...


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] z3c.extfile and ZEO ?

2006-09-01 Thread Thierry Florac





 Hi,

I just discovered the z3c.extfile package that I'd like to use in my current Zope3 development.
My question is simple : what are the requirements to use this package in a ZEO context with several servers ?

Thanks for any advise,




 Thierry Florac
-- 



 Chef de projet intranet/internet
 Office National des Forts - Dpartement Informatique
 2, Avenue de Saint-Mand
 75570 PARIS Cedex 12
 Ml : [EMAIL PROTECTED]
 Tl. : +33 01.40.19.59.64
 Fax. : +33 01.40.19.59.85








___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Localizing Zope3 content

2006-07-07 Thread Thierry Florac

  Hi,

I'd like to have a few advises about Zope3 content localization.
My problem is as follow :
 - I have to build a new web site ; this site will mainly be in french
= OK
 - some parts of the web site will be available in another language
(english, german and spanish) = OK

but :

 - some documents are available in several languages at the same time ;
they then have to be seen, from the contributor point of view, as a
single document written in several languages (of course, interfaces and
available fields will be the same for each language)
 - the same workflow is applied to all languages, but each language
version can be in a different step in the workflow (for example, the
french version can be published while the english one still have to be
validated and the german is still a draft ; the spanish one have yet to
be written...)
 - from the user point of view, language selection can be done via
browser settings or via a cookie-based setting ; but the different
versions of a same document have to keep the same URL.

From now, I looked at Localizer and other Zope2 localization products
which gave me a few ideas, but I'd really like to have as many advises
as possible about this problem and the better way it should be handled
in Zope3.

Thanks for any advise,

  Thierry Florac
-- 
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : [EMAIL PROTECTED]
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Splitting ZODB ?

2006-06-20 Thread Thierry FLORAC




Hi,

While using Zope2, I used to split my ZODB into several parts, using the old DBTab product configuration (which was finally included into Zope2).
Can I setup this kind of configuration with Zope3 and, if so, how ?
Of course, are there also any drawbacks ?

Thanks for any information,
Thierry









-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Question about ForbiddenAttribute...

2006-06-14 Thread Thierry FLORAC
On Tue, 2006-06-13 at 08:26 +0200, Marco Mariani wrote:
 Thierry FLORAC wrote:
page
  name=images.html
  for=.interfaces.IGalleryFolder
  allowed_interface=.interfaces.IGalleryPhoto
  template=folder_images.pt
  permission=zope.View
  class=.folder.FolderInfo
  menu=zmi_views title=Images /
 
  But when trying to display the view, a ForbiddenAttribute exception is
  raised :
File .../browser/folder.py, line 39, in getImages
  result.sort (lambda x,y:
   cmp(IGalleryPhoto(x).name,IGalleryPhoto(y).name))
ForbiddenAttribute:('sort',[GalleryPhoto object at 0xa5b378ac,...] 
 
  So the forbidden attribute seems to be the sort method of the
  resulting array, which of course isn't part of any of my interfaces.
 
  In such a case, I solved the problem by moving the getSortedImages to
  the folder interface and content class.

 You have to define an empty getImages method on the interface.

getImages() is already defined into IPhotoFolder interface. But Philip
already sent a reply with a full and clear explanation of my problem...


  But that may not always be possible, so how can I get access to such
  methods ??

 Why should it not be possible? After all, you defined the FolderInfo
 view for the IGalleryFolder _Interface_, not the GalleryFolder class.

What I just mean (but perhaps I'm wrong) is that in my use case, the
getSortedImages() method is only used for presentation purpose in a
specific context, a specific browser view.
I think this kind of method shouldn't have to be defined in an interface
which main goal is to define generic content handling methods...
I don't know if my explanation is clear :-(

  Thierry




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Question about ForbiddenAttribute...

2006-06-14 Thread Thierry FLORAC
On Tue, 2006-06-13 at 08:28 +0200, Philipp von Weitershausen wrote:
 As said above, 'result' will be security proxied. Security proxies for
 lists only allow methods that don't change the lists. result.sort()
 would change it. Hence it's forbidden.
 
 An easy workaround is to use sorted():
 
   result = IGalleryFolder(self.context).getImages()
   return sorted(result, cmp=...)
 
 Note that using 'cmp' is very slow. It's much faster to use 'key':
 
   result = IGalleryFolder(self.context).getImages()
   return sorted(result, key=lambda x: IGalleryPhoto(x).name)

Tried this, but it doesn't work because of another ForbiddenAttribute
error :

  File .../gallery/browser/folder.py, line 39, in getImages
return sorted(result, key=lambda x: IGalleryPhoto(x).name)
  File .../gallery/browser/folder.py, line 39, in lambda
return sorted(result, key=lambda x: IGalleryPhoto(x).name)
ForbiddenAttribute: ('name', gallery.photo.GalleryPhoto object at
0xa5bc46ac)

As said before, 'IGalleryPhoto' (implemented by GalleryPhoto) is
provided in the allowed_interface attribute of my ZCML's view page
definition...

Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Question about ForbiddenAttribute...

2006-06-12 Thread Thierry FLORAC
Hi,

I'm trying to build a sample photos management application for Zope-3.2,
with the following interfaces and classes :

 - class IGalleryPhoto(IContainer)
 ...

 - class IGalleryContainer(IContainer)
 (marker interface used for preconditions)

 - class IGalleryFolder(IGalleryContainer)
 def getImages():
   ...

 - class IGallery(IGalleryFolder,IPossibleSite)
 ...

 - class GalleryPhoto(BTreeContainer)
 ...

 - class GalleryFolder(Folder)
 def getImages(self):
   return [item for item in self.values() 
 if IGalleryPhoto.providedBy(item)]

 - class Gallery(GalleryFolder, SiteManagerContainer)
 ...

Until now, it's OK !
After that, I created a sample view based on a page template for
IGalleryFolder, using a view class :

  - tal:x repeat=image view/getImages ... /tal:x

  - class FolderInfo:

  def getImages(self):
Get a sorted list of images
result = IGalleryFolder(self.context).getImages()
result.sort (lambda x,y: cmp(IGalleryPhoto(x).name,
 IGalleryPhoto(y).name))
return result

The view is registered in ZCML like this :

  page
name=images.html
for=.interfaces.IGalleryFolder
allowed_interface=.interfaces.IGalleryPhoto
template=folder_images.pt
permission=zope.View
class=.folder.FolderInfo
menu=zmi_views title=Images /

But when trying to display the view, a ForbiddenAttribute exception is
raised :
  File .../browser/folder.py, line 39, in getImages
result.sort (lambda x,y:
 cmp(IGalleryPhoto(x).name,IGalleryPhoto(y).name))
  ForbiddenAttribute:('sort',[GalleryPhoto object at 0xa5b378ac,...] 

So the forbidden attribute seems to be the sort method of the
resulting array, which of course isn't part of any of my interfaces.

In such a case, I solved the problem by moving the getSortedImages to
the folder interface and content class.
But that may not always be possible, so how can I get access to such
methods ??

Thanks for any help,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: IEndRequestEvent question

2006-06-06 Thread Thierry FLORAC




On Tue, 2006-06-06 at 13:32 +0200, Philipp von Weitershausen wrote:


 My goal is to use request annotations to reference several objects that
 should be treated after the main request process is done, and then to
 subscribe to this event to fire these final modifications (so that, for
 example, IObjectModifiedEvent is not fired too many times). Is it the
 good approach ?

Why are you concerned about IObjectModifiedEvent being fired too many times?



Thanks for your previous explanations : it's clear in my mind, now !

My first idea with this problem was to say : a content object can be modified several times during a request execution, sometimes by other content objects and not only by simple editing forms (which automatically fire IObjectModifiedEvent), and I want some kind of expensive application logic (for example, reindexing) to be applied only once, when all modifications are done.
So the IEndRequestEvent was, to me, a good place to handle this kind of methods ; but your previous explanation show that I was wrong.
I also thought about using some kind of request annotations or volatile attributes, but as event handlers are fired synchronously, I thing that I can't know if there are more modifications to come before the end of the request or not.
In fact, I thing that what I should need is a kind of IBeforeEndRequestEvent, an event which would be fired before the end of the request, but when transactions and local utilities are still available...

Of course, any kind of complement would as always be very welcome...

Thanks,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] IEndRequestEvent question

2006-06-05 Thread Thierry FLORAC





 Hi,

I'd like to ask several questions about IEndRequestEvent, like :
 - when is this event actually fired ?
 - what can be done exactly after this event is fired (still query components, update database...) ?
 - if possible, are modifications done after this event integrated into the main transaction ?

My goal is to use request annotations to reference several objects that should be treated after the main request process is done, and then to subscribe to this event to fire these final modifications (so that, for example, IObjectModifiedEvent is not fired too many times). Is it the good approach ?

Thanks for any help,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to prevent several notifications of events ?

2006-06-01 Thread Thierry FLORAC




On Thu, 2006-06-01 at 12:27 +0200, Florent Guillaume wrote:


Thierry FLORAC wrote:
 I've build a simple adapter that modifies context properties through
 annotations ; everything works fine.
 In several cases, when some attributes are updated, I do a
 notify(ObjectModifiedEvent(self.context)) so that several subscribers
 are called.
 
 My problem is then that if several attributes modifications are done,
 several ObjectModifiedEvent are sent and the same handler is called
 several times (with the same parameters) ; so is it easily possible to
 prevent the same event to be called several times for a same context and
 a same request ?
 Or should I try to use request annotations and subscribe to
 IEndRequestEvent (if it's not too late and not too expensive...) ?

Yes that's the proper way to do compress events: record the stuff to do, and 
do it at the end of the request.

Depending on the stuff to do, it may involve subtleties, for instance if you 
modify one object then delete it in the same request, you don't want to call 
your final handler for that object...



Thanks for the reply, but I'd like to have a few complements :
 - I suppose that IEndRequestEvent is sent automatically for every request, so even for consultation requests which doesn't imply any modification. So I suppose that the IEndRequestEvent handler have to be VERY optimised if I don't want it to be too expensive.
 - what is the best way to keep track of objects having been modified (and which, for example, should be re-indexed) into request annotations. Can I just put an object into an annotation's list (with a kind of IAnnotations(request)['myKey'].append(context)) ??

Thanks,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] How to prevent several notifications of events ?

2006-05-31 Thread Thierry FLORAC





 Hi,

I've build a simple adapter that modifies context properties through annotations ; everything works fine.
In several cases, when some attributes are updated, I do a notify(ObjectModifiedEvent(self.context)) so that several subscribers are called.

My problem is then that if several attributes modifications are done, several ObjectModifiedEvent are sent and the same handler is called several times (with the same parameters) ; so is it easily possible to prevent the same event to be called several times for a same context and a same request ?
Or should I try to use request annotations and subscribe to IEndRequestEvent (if it's not too late and not too expensive...) ?

Thanks for any help,

 Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Newbie question...

2006-03-21 Thread Thierry FLORAC
On Mon, 2006-03-20 at 19:02 -0500, Stephan Richter wrote:
 On Monday 20 March 2006 17:26, Thierry FLORAC wrote:
  Actually, the only working way I found to update my annotations through
  my adapters is always to use form directives with the help of a
  support class using getData/setData methods which call the adapter
  directly...
 
 Can you post the code again, the one that is not working? Note that a 
 persistent dict is no good, since the form code tries to set an attribute and 
 not a mapping item.

You will find a copy of my previous post below.
I just hope I didn't forgot anything...

Thanks for any help,

  Thierry

-

I've started to work a little more on this problem, and got a few
improvements but still a few problems. In fact :
 - I can create my main content component correctly
 - I can see the adapter's view form into ZMI
 - I can select this view ; an empty annotations PersistentDict is
then immediately created as requested
 - but I can't update adapter's interface's properties : the setData
method is called, but the properties methods are not called when
setData is called. No error is displayed, and the form just display
request values that are removed as soon as the view is refreshed...

My code is in fact very simple :

class IPhotoStorage:
identifier = TextLine(...)
hostname = TextLine(...)

PhotoStorageKey = http://www.ulthar.net/keys/storage;

class PhotoStorage:
implements(IPhotoStorage)
adapts(IPhoto)

def __init__ (self, context):
self.context = self.__parent__ = context
annotations = IAnnotations(context)
data = annotations.get(PhotoStorageKey)
if data is None:
data = annotations[PhotoStorageKey] = PersistentDict()
self._data = data

def _getIdentifier (self):
return self._data.get('identifier',None)

def _setIdentifier (self, identifier):
self._data['identifier'] = unicode(identifier)
notify(ObjectModifiedEvent(self.context))

identifier = property(_getIdentifier, _setIdentifier)

[...then same code for hostname property...]

class PhotoStorageHandler(object):

def getData(self):
result = {}
result['identifier']= IPhotoStorage(self.context).identifier
result['hostname'] = IPhotoStorage(self.context).hostname
return result

def setData(self, data):
IPhotoStorage(self.context).identifier = data['identifier']
IPhotoStorage(self.context).hostname = data['hostname']
return uSaved changes


And here is my main configure.zcml part for the adapter :

adapter
factory=.photo.PhotoStorage
provides=.interfaces.IPhotoStorage
for=.interfaces.IGalleryPhoto
trusted=true /

class class=.photo.PhotoStorage
require
permission=zope.View
interface=.interfaces.IPhotoStorage /
require
permission=zope.ManageContent
set_schema=.interfaces.IPhotoStorage /
/class

and finally my browser configure.zcml :

form
name=storage.html
for=.interfaces.IGalleryPhoto
schema=.interfaces.IPhotoStorage
class=.forms.PhotoStorageHandler
fields=identifier hostname
label=Storage
permission=zope.ManageContent
menu=zmi_views title=Storage /

A few print instructions show that :
 - PhotoStorageHandler.setData is called correctly, but
 - PhotoStorage._setIdentifier is NOT called when setting identifier
property



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Newbie question...

2006-03-21 Thread Thierry FLORAC
On Tue, 2006-03-21 at 17:59 -0500, Stephan Richter wrote:
 On Tuesday 21 March 2006 17:39, Thierry FLORAC wrote:
  class IPhotoStorage:
 
 Well, this needs to inherit Interface.

Of course it is !
I just forgot to put the correct syntax for this inheritance in my
post... :-(


  class PhotoStorage:
 
 try to make this a new-style class:
 
 class PhotoStorage(object)
 
 Let me know what the outcome was.

Well, hum, how could I say that ?
Ho, probably just : It's amazing, but it works !
Except if I forgot something (I did so many tries to make this
working...), I just rolled back to the previous release of my code,
added the object superclass to my adapter, removed my form handler and
switched back my ZCML configuration to the editform version of my
form...
Printed traces shows that everything works fine, and introspector show
that my annotations are now updated correctly through my properties...

Of course, I'm not sure to really understand the difference between this
code and the previous one, and why this object inheritance is so
important (I've always thought that every Python class was automatically
inheriting from object).
So any kind of explanation would be really welcome !

Many thanks,

  Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Thierry FLORAC
On Mon, 2006-03-20 at 10:16 -0500, Stephan Richter wrote:
 On Wednesday 15 March 2006 17:45, Thierry FLORAC wrote:
  TraversalError: (zc.catalog.catalogindex.SetIndex object at
  0xb46bfd2c, 'documentCount')
 
 
  documentCount seems to be defined into the SetIndex class, so I
  don't understand this error...
 
 Well, by default attributes are not traversable, so that the following does 
 not work:
 
 object/attrname
 
 But this should work:
 
 object/++attribute++attrname
 
 SchoolTool has developed a clever dynamic Traversal mechanism that allows you 
 to do the first case:
 
 http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/traverser/

But I'm just trying to use a simple (not subclassed) SetIndex, and
then to access my catalog Advanced management page...!
I don't build any specific template for this.

Should I build any specific SetIndex subclass ? Or define a specific
template ??

Thanks,
Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Newbie question...

2006-03-20 Thread Thierry FLORAC




On Mon, 2006-03-20 at 09:45 -0500, Stephan Richter wrote:


On Saturday 04 March 2006 10:01, Thierry FLORAC wrote:
 - define editform in browser's configure.zcml = probably bad !

If the for attribute differs from the schema attribute in the edit form, 
the form will automatically look up an adapter from the context object 
(implementing the for interface) to the interface specified in schema.



I tried to add the for attribute to my configure.zcml editform statement, but the problem I described in several previous post (between march 04 and march 07) remains :
 - on first read access to the form, annotations (a PersistentDict) are correctly defined
 - if trying to set values, modifications seems to be applied, but in fact they are lost when refreshing the form (they are probably just extracted from request) and the adapter setters are not called (as seen if printing to standard output).

Actually, the only working way I found to update my annotations through my adapters is always to use form directives with the help of a support class using getData/setData methods which call the adapter directly...

Any idea ?
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Problem with SetIndex (from zc.catalog)

2006-03-20 Thread Thierry FLORAC
On Mon, 2006-03-20 at 17:37 -0500, Gary Poster wrote:
 On Mar 20, 2006, at 5:14 PM, Thierry FLORAC wrote:
  But I'm just trying to use a simple (not subclassed) SetIndex, and
  then to access my catalog Advanced management page...!
  I don't build any specific template for this.
 
  Should I build any specific SetIndex subclass ? Or define a specific
  template ??
 
 Thierry, try adding the following to zc.catalog's configure.zcml  
 (this is for all four of the zope.app.catalog-aware indexes).
 
content class=.catalogindex.ValueIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.SetIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.DateTimeValueIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
content class=.catalogindex.DateTimeSetIndex
  require
  permission=zope.ManageServices
  interface=zope.app.catalog.interfaces.IAttributeIndex
 zope.index.interfaces.IStatistics

  set_schema=zope.app.catalog.interfaces.IAttributeIndex
  /
/content
 
 
 Then give it a try.  (This only works if you are using the indexes I  
 listed, but you probably get the idea.)  If this helps, we should  
 check it in.

Modification is OK (at first, see below) for the first indexes, but an
error is raised while starting Zope for the DateTime indexes, because
class attribute points to a method name :

zope.configuration.config.ConfigurationExecutionError:
exceptions.TypeError: type_ must be a type, class or module, not
a function DateTimeValueIndex at 0xb672510c in:
File
/usr/local/zope/3.2/var/lib/python/zc/catalog/configure.zcml,
line 58.3-66.3
 content class=.catalogindex.DateTimeValueIndex
   require
   permission=zope.ManageServices

interface=zope.app.catalog.interfaces.IAttributeIndex
  zope.index.interfaces.IStatistics
 

set_schema=zope.app.catalog.interfaces.IAttributeIndex
   /
 /content

After removing this modification for the two last indexes, I can access
catalog's advanced management screen without error, but information is
not really fine : on a SetIndex for example, Document Count and Word
Count columns are displayed as security proxied BTrees.Length.Length
instance at 0xb4dc052c instead of their numeric values...

  Thierry



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Check permissions

2006-03-17 Thread Thierry FLORAC

  Hi,

I think that you can also use something like this :

from zope.security.management import getInteraction

def checkPermission(object, permission='zope.ManageContent'):
interaction = getInteraction()
return interaction.checkPermission(permission, object)

I don't know what's the difference between the two methods, and so I
don't if one of them is better than the other one...

  Thierry


On Fri, 2006-03-17 at 13:34 +, Rupert Redington wrote:
 from zope.security.management import checkPermission
 
 if checkPermission('zope.ManageContent', self.context):
  ... 
 
 Cheers,
 
 Rupert
 
 Frank Burkhardt wrote:
  Hi,
  
  how can I test, if the current principal (e.g. by being member in a special
  group) has a given permission on a given content object?
  
  Maybe something like this:
  
   if 'zope.ManageContent' in self.context.permissions():
  ...
  
  This should include all permission defined in ZCML *and* all permission
  granted in ZMI.
  
  Thank you for all hints.
  
  Regards,
  
  Frank




-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Can't make site of a BTreeContainer

2006-03-12 Thread Thierry FLORAC




On Sat, 2006-03-11 at 22:54 +0100, Florian Lindner wrote:


try to also derive your interface of the object that should become a site from 
zope.app.component.interfaces.IPossibleSite

 class IGallery (IGalleryFolder, IPossibleSite):


Hope this helps,



Yes, it works perfectly !
Just lost a full day for a single missing word...  !!

Many thanks,
Thierry


-- 
This message has been scanned for viruses and
dangerous content by
MailScanner, and is
believed to be clean.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


  1   2   >