[Zope] [python script] problem with AUTHENTICATED_USER

2005-04-20 Thread BonviciniJ
I have problem with my python script.
I want to check if a user has a the manager role, and add an option in a menu 
in this case
Here is my script:

for el in rep.objectValues('Folder'): 
if el.id==Administration and AUTHENTICATED_USER.has_role(self, 
[Manager]):
  #add option to the menu



but Zope displays me an error:
Error Type: NameError
Error Value: global name 'AUTHENTICATED_USER' is not defined 

I don't know what is the problem.
I use sessionUserFolder (a Zope products), so I think it could be the reason of 
the problem.
Thank you for your help

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


[Zope] [python script] problem with AUTHENTICATED_USER

2005-04-20 Thread BonviciniJ
I have another problem (not in relation with  AUTHENTICATED_USER):
I would like to know if a special function exists to transform special char in 
html (like HTMLentities in PHP or escape in javascript)
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] [Zope/DTML] accessing PARENTS url with dtml tag ???

2005-04-15 Thread BonviciniJ
I have found a similar problem at this url:
http://mail.zope.org/pipermail/zope/2000-August/115809.html

I want to do the same a Kapil, but in DTML.
I tried different solutions:
1)dtml-with PARENTS[0]dtml-var absolute_url/dtml-with
2)dtml-var PARENTS[0].absolute_url()

but I still have the problem.
I wannt to display (in DTML) the absolute URL of the parent, but it doesn't 
work: 
it displays the absolute url of the CURRENT object.

could you help me to find the solution please?

thanks (and excuse for my lack in english)




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


Re:[Zope] [Zope/DTML] accessing PARENTS url with dtml tag ???

2005-04-15 Thread BonviciniJ
thanks a lot for your help,
it works perfectly

-original message--
Try this construction:

dtml-with expr=aq_parentObject: dtml-var title_or_id url: 
dtml-var absolute_url/dtml-with

Cliff

BonviciniJ at keops.net http://mail.zope.org/mailman/listinfo/zope wrote:
 I have found a similar problem at this url:
  http://mail.zope.org/pipermail/zope/2000-August/115809.html
 
 I want to do the same a Kapil, but in DTML.
 I tried different solutions:
 1)dtml-with PARENTS[0]dtml-var absolute_url/dtml-with
 2)dtml-var PARENTS[0].absolute_url()
 
 but I still have the problem.
 I wannt to display (in DTML) the absolute URL of the parent, but it doesn't 
 work: 
 it displays the absolute url of the CURRENT object.
 
 could you help me to find the solution please?
 
 thanks (and excuse for my lack in english)
 

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


[Zope] how to expand a branch using dtml-tree ?

2005-04-11 Thread BonviciniJ
I would like to know if its possible to expand a specified branch of a 
tree,using the dtml-tree tags.

I use this tag to display the tree of my site:

dtml-tree expr=Ebullition.pages nowrap=true single=1  skip_unauthorized
   A HREF=dtml-var absolute_urldtml-var title_or_id/A  
 /dtml-tree

But I have a problem.I want the chosen branch to keep expanded when the user 
click on the link.
At the moment, when I click on a branch (expanded or not), the page is called 
buit the tree is initialised (all branches collapsed)

So I wonder if its possible to kepp the branch expanded (by adding a special 
line, or send via post the id of the branch and expand it on the next loading 
of the page).
I add that The tree is in the same page and I don't want to use frames

thanks a lot for your help, and scuse for the english


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


[Zope] Zope/python: downloading images from the web and add them to Zope

2005-04-08 Thread BonviciniJ
I would like to know how to add image file from an URL.
I created a form with to pissibilities: add an image from a local file , and a 
image from an url

here is my form:
input type=radio name=sourcePicture checked onClick=lock_option() 
value=file
get from disk: input type=file name=pict_file size=40 accept=image 
maxlength=50

br

input type=radio name=sourcePicture onClick=lock_option() 
value=internet
get from the internetinput type=text name=pict_internet size=40 
value=http://www.monsite.fr/monimage.jpg; disabled=disabled

This form call a python script:

if REQUEST.sourcePict==file:
 pathImgs.manage_addProduct['OFSP'].manage_addImage(pict_+id, 
REQUEST.pict_file, title=pictogramme metier, precondition=, content_type=)
else:
pathImgs.manage_addProduct['OFSP'].manage_addImage(pict_+id, 
REQUEST.pict_internet, title=pictogramme metier, precondition=, 
content_type=)


With a locl file it works (case sourcePict=file), but when I want to add images 
from an url, it doesn't work.
I suppose that the second parameter of manage_addImage must be a file type.In 
the first case, it works , but in the second, the parameter passed is a string 
(complete url of the image).
so how to do?

thanks for your answers and excuse me for the lack in English (I'm french)
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )