Re: [Zope] Re: adding a python library

2006-11-15 Thread Chris Withers

David Bear wrote:
I am now looking at the modules feedparser imports. 


You don't need to cover these, just the types you need to import from 
the library itself and any classes or special types that get returned 
from methods in the things you import from the library.


That said, if I were you, I'd just wrap up all the bits you need in an 
external method.


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 )


Re: [Zope] Re: adding a python library

2006-11-14 Thread David Bear
On Tue, Nov 14, 2006 at 07:12:51PM +0100, Andreas Jung wrote:
> 
> 
> --On 14. November 2006 10:52:31 -0700 David Bear <[EMAIL PROTECTED]> wrote:
> 
> >I am now looking at the modules feedparser imports. These include
> >
> >sgmllib
> >re
> >sys
> >copy
> >urlparse
> >time
> >rfc822
> >types
> >cgi
> >urllib
> >urllib2
> >cStringIO
> >xml.sax
> >
> >
> 
> What are you trying to accomplish? Put your code into an external method 
> which is unrestricted (*hint*: look at the Zope Book 2.7 edition).

excellent. I think this is really what I wanted to do.

> 
> -aj



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


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


[Zope] Re: adding a python library

2006-11-14 Thread Josef Meile

Hi,


I am now looking at the modules feedparser imports. These include

sgmllib
re
sys
copy
urlparse
time
rfc822
types
cgi
urllib
urllib2
cStringIO
xml.sax

It seems that sys would be a bad one to allow zope to import.
Well, you don't have to allow all of them. You only need to allow the 
feeparser module and use it from your python scripts or classes, zpt, 
and from dtml (if you still use it)


Regards
Josef
___
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] Re: adding a python library

2006-11-14 Thread Andreas Jung



--On 14. November 2006 10:52:31 -0700 David Bear <[EMAIL PROTECTED]> wrote:


I am now looking at the modules feedparser imports. These include

sgmllib
re
sys
copy
urlparse
time
rfc822
types
cgi
urllib
urllib2
cStringIO
xml.sax




What are you trying to accomplish? Put your code into an external method 
which is unrestricted (*hint*: look at the Zope Book 2.7 edition).


-aj

pgpjePGJGU37D.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] Re: adding a python library

2006-11-14 Thread David Bear
On Tue, Nov 14, 2006 at 05:50:36PM +0100, Andreas Jung wrote:
> 
> 
> --On 14. November 2006 09:32:38 -0700 David Bear <[EMAIL PROTECTED]> wrote:
> 
> >
> >What if I created a zope script and just pasted the feedparser.py
> >modules contents into it.
> 
> That would be a stupid idea.
> 
> >Do python scripts that live inside zodb
> >become importatable?
> >
> Zope PythonScripts are *objects* that are callable through acquisition.

thanks for all the replies.

I am now looking at the modules feedparser imports. These include

sgmllib
re
sys
copy
urlparse
time
rfc822
types
cgi
urllib
urllib2
cStringIO
xml.sax

It seems that sys would be a bad one to allow zope to import.

Are there others in this list that I should not allow?


> 
> -aj



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


-- 
David Bear
phone:  602-496-0424
fax:602-496-0955
College of Public Programs/ASU
University Center Rm 622
411 N Central
Phoenix, AZ 85007-0685
 "Beware the IP portfolio, everyone will be suspect of trespassing"
___
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] Re: adding a python library

2006-11-14 Thread David Bear
On Mon, Nov 13, 2006 at 08:32:11PM -0500, Tres Seaver wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> David Bear wrote:
> > I would like to add Mark Pilgrims feedparser to the available modules
> > that I can use in zope. I have installed the feedparser into the
> > python instance that zope uses. However, when I attempt to import it,
> > I get an error that I'm not authorized. How might I make the
> > feedparser available to zope?
> 
> Check the examples in
> $SOFTWARE_HOME/lib/python/Products/PythonScripts/module_access_examples.py
> 

Thanks. This seems straightforward. However, I am now rethinking this.

What if I created a zope script and just pasted the feedparser.py
modules contents into it. Do python scripts that live inside zodb
become importatable?

> 
> Tres.
> - --
> ===
> Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
> Palladion Software   "Excellence by Design"http://palladion.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.2.2 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFFWRyb+gerLs4ltQ4RAkJYAKCOkGX3CKz+aNTvhtRTHdk8FAzPlgCgkk29
> xt7g8f92Lo6zOjLG4w/yYH4=
> =71Qs
> -END PGP SIGNATURE-
> 
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

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


Re: [Zope] Re: adding a python library

2006-11-14 Thread Tino Wildenhain

David Bear schrieb:

On Mon, Nov 13, 2006 at 08:32:11PM -0500, Tres Seaver wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Bear wrote:

I would like to add Mark Pilgrims feedparser to the available modules
that I can use in zope. I have installed the feedparser into the
python instance that zope uses. However, when I attempt to import it,
I get an error that I'm not authorized. How might I make the
feedparser available to zope?

Check the examples in
$SOFTWARE_HOME/lib/python/Products/PythonScripts/module_access_examples.py



Thanks. This seems straightforward. However, I am now rethinking this.

What if I created a zope script and just pasted the feedparser.py
modules contents into it. Do python scripts that live inside zodb
become importatable?


No, not at all, a "Script (Python)" Object is much more like a
class method of the container object (e.g. Folder).

So if you write a python script in ZODB/ZMI with name foo
in folder bar, its comparable to somethign like that:

class bar:
 ...

   def foo(context,)
   [your method body here ]

(not literally of course since acquisition
and all that comes into play, but as a thought model.

Regards
Tino
___
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] Re: adding a python library

2006-11-14 Thread Andreas Jung



--On 14. November 2006 09:32:38 -0700 David Bear <[EMAIL PROTECTED]> wrote:



What if I created a zope script and just pasted the feedparser.py
modules contents into it.


That would be a stupid idea.


Do python scripts that live inside zodb
become importatable?


Zope PythonScripts are *objects* that are callable through acquisition.

-aj

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


[Zope] Re: adding a python library

2006-11-13 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Bear wrote:
> I would like to add Mark Pilgrims feedparser to the available modules
> that I can use in zope. I have installed the feedparser into the
> python instance that zope uses. However, when I attempt to import it,
> I get an error that I'm not authorized. How might I make the
> feedparser available to zope?

Check the examples in
$SOFTWARE_HOME/lib/python/Products/PythonScripts/module_access_examples.py


Tres.
- --
===
Tres Seaver  +1 202-558-7113  [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"http://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFWRyb+gerLs4ltQ4RAkJYAKCOkGX3CKz+aNTvhtRTHdk8FAzPlgCgkk29
xt7g8f92Lo6zOjLG4w/yYH4=
=71Qs
-END PGP SIGNATURE-

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