Re: [Zope] display results from external source in zpt

2006-03-16 Thread Chris Withers

Dean Hale wrote:


I'm assuming i need to add some extra details to the __init__.py file is 
this correct and if so have you any ideas what they would be


from Products.PythonScripts.Utility import allow_module

allow_module('urllib')


I dunno if it'll help, but try enabling verbose security in your zope.conf.

However, you may just need to fiddle.

Try adding some allow_* statements for urlopen as well as anything else 
you import from urllin and see how you go.


That said, it may be easier (and execute faster) if you just duck out 
and use an external method.


Also, be aware that doing what you're doing, the performance of your 
website now depends on the performance of another website, and the 
network between your webserver and the other webserver. This may not be 
what you want. You should certainly look at introducing a socket timeout 
for those connections


Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

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

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


Re: [Zope] display results from external source in zpt

2006-03-16 Thread Chris Withers

Andreas Jung wrote:


allow_module() is not a solution for all and everything (consider it a 
hack).


Don't be rediculous. It's not a hack, it's the documented way of 
providing security assertions from existing code without having to patch 
it. That sounds a lot like what the component architecture is, and I 
don't think anyone's likely to call that a hack.


However, those allow_* functions are rather confusing. The documentation 
could do with beefing up and the circumstances where they don't work 
should be raised as bugs...


cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

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

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


[Zope] display results from external source in zpt

2006-03-15 Thread Dean Hale


Hi,

Apologies if this is easy to do, cannot find any help in the archives 
(but then again not sure what to search for)


We currently run a script on an external server which returns results 
depending on the userid of the user, which is added to the link below 
once the user logs into zope.


It works and displays what is needed, however i would like to display 
the results somehow within a page template rather than the user having 
to go elsewhere to see the results.


a href= tal:define=uid python:member.getProperty('uid') 
tal:attributes=href 
string:http://site.ac.uk/cgi-bin/tasks?uid=$uidfmt=plain;view results/a


Basically we would like to run above somehow but all results are 
returned within the same page.


Hope this makes sense and is this possible?

thanks very much
dean
___
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] display results from external source in zpt

2006-03-15 Thread Andreas Jung



--On 15. März 2006 09:14:42 + Dean Hale [EMAIL PROTECTED] 
wrote:




a href= tal:define=uid python:member.getProperty('uid')
tal:attributes=href
string:http://site.ac.uk/cgi-bin/tasks?uid=$uidfmt=plain;view
results/a


Look at Python's urllib module.

-aj


   ---
  -   Andreas JungZOPYX Ltd.  Co KG-
 -   E-mail: [EMAIL PROTECTED]   Web: www.zopyx.com, www.zopyx.de -
  ---


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


Re: [Zope] display results from external source in zpt

2006-03-15 Thread Dean Hale
Hi Andreas,Thanks for this i'm trying to use an example belowfrom urllib import *url = ''">http://site.ac.uk/cgi-bin/evisiontasks?uid=xxx0xxxfmt=plain'html = urlretrieve(url).read()however am receiving the errorError Value: "from urllib import *" is not allowedi have followed the readme in python/Products/PythonScripts and created a __init__.py file and it has created a __init__.pyc file once the server has restated.I'm assuming i need to add some extra details to the __init__.py file is this correct and if so have you any ideas what they would befrom Products.PythonScripts.Utility import allow_moduleallow_module('urllib')Sorry if the answer is obvious.thanksdeanOn 15 Mar 2006, at 09:23, Andreas Jung wrote:--On 15. März 2006 09:14:42 + Dean Hale [EMAIL PROTECTED] wrote: a href="" tal:define="uid python:member.getProperty('uid')"tal:attributes="hrefstring:http://site.ac.uk/cgi-bin/tasks?uid=$uidfmt=plain"viewresults/a Look at Python's urllib module.-aj   ---  -   Andreas Jung            ZOPYX Ltd.  Co KG                        - -   E-mail: [EMAIL PROTECTED]   Web: www.zopyx.com, www.zopyx.de         -  ------ Dean Hale  Web Development Manager Library Services  University of Sunderland  w: https://my.sunderland.ac.uk  t: +44 (0) 191 515 2424 f: +44 (0) 191 515 2904  ___
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] display results from external source in zpt

2006-03-15 Thread Andreas Jung



--On 15. März 2006 12:03:48 + Dean Hale [EMAIL PROTECTED] 
wrote:




Hi Andreas,

Thanks for this i'm trying to use an example below

from urllib import *
url = 'http://site.ac.uk/cgi-bin/evisiontasks?uid=xxx0xxxfmt=plain'
html = urlretrieve(url).read()

however am receiving the error

Error Value: from urllib import * is not allowed

i have followed the readme in python/Products/PythonScripts and  created
a __init__.py file and it has created a __init__.pyc file  once the
server has restated.

I'm assuming i need to add some extra details to the __init__.py file  is
this correct and if so have you any ideas what they would be


allow_module() is not a solution for all and everything (consider it a 
hack).

Either write your code as external method or look at TrustedExecutables.

-aj

   ---
  -   Andreas JungZOPYX Ltd.  Co KG-
 -   E-mail: [EMAIL PROTECTED]   Web: www.zopyx.com, www.zopyx.de -
  ---


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