Re: [Zope] reading zope.config file for ClientStorage

2005-10-11 Thread Chris Withers

Mika, David P (Research) wrote:

from Zope.Startup import options, handlers
opts = options.ZopeOptions()
opts.configfile='c:\Zope-Instance-Test\etc\zope-with-zeo.conf'
opts.load_schema()
opts.load_configfile()


What does your zope-with-zeo.conf file look like?


The schema file that is being used by ZopeOptions is Zope/Startup/zopeschema.xml.  
This only has a skeleton zodb_db section.  It looks like the meat & potatoes 
are in ZODB/component.xml, but I don't see how that is actually pulled in.


There will be an import statement in zopeschema.xml

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] proxy role for an external method

2005-10-11 Thread Chris Withers

Reinoud van Leeuwen wrote:

On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:


Are you using CMF/Plone?



yes. the main part of the function is:

   for brain in self.portal_catalog(portal_type='User',
SearchableText=SearchableText):
user = brain.getObject()
if user is None:
continue
results.append(getUserInfo(user))

This works in a pyhton script but not in an external one


At this point I'd recommend my SainBrains product:
http://www.simplistix.co.uk/software/zope/sanebrains

Then, change your user = line to:

user = brain._unrestrictedGetObject()

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] Zope security and packing the database

2005-10-11 Thread Chris Withers

Cameron Beattie wrote:
I have created a script based on zope_pack from the Zope book which 
allows a username and password to be specified when it is called. I wish 
to create a user specifically for this purpose that only has the ability 
to pack the ZODB.


What permission is ZODB packing protected by?

granted the backup role all available permissions. But the user can't 
login to 
http://mydomain.com/Control_Panel/Database/main/manage_workspace 


I don't know what zope_pack looks like, can you show us?
What error message do you get?
Any tracebacks?

cheers,

Chris

PS: I wouldn't do zodb packing by whacking a url. There's a script that 
scripts with ZOpe now that opens up a ZEO connection and does the pack 
that way, that's what I'd do...


--
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: Presentations Available

2005-10-11 Thread Chris Withers

Hi Nick,

Nick Davis wrote:
  BTW Both Chris and I come from the UK where complaining about things 
is a national sport so please no-one take offence. ;-)


Nah, the Plone stuff is beyond mere national past time. The excruciating 
agony it's caused me on a fairly regular basis for a number of years now 
is what's behind it, and the talk I gave at the Plone conference is 
merely a more in depth look at why it makes my cry ;-)


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] Re: Re: ZAjax anyone?

2005-10-11 Thread Balazs Ree
On Mon, 10 Oct 2005 23:28:03 +0800 Bakhtiar A Hamid wrote: 
> we have zope (dtml/script/zsql-method) that do specific calls that spits
> out results via xmlrpc.
> 
> on the browser side, we have all these ajax libs - openrico, dojo,
> mochikits, azax, DataRequestor, jsolait, tim morgan's mini, etc
> 
> we just need to connect the dots. the ajax lib + our java functions/etc
> will call dtml/script/sql-method via xmlrpc(builtin) or jasonrpc(with the
> jsonrpc product) and page will be updated inline(?)
> 
> not much voodo involved. everything is there already.
> 
> a simple demo is at http://myzope.kedai.com.my/blogs/kedai/demo/; a script
> python that just spits out DateTime().pCommon(), and the other, a script
> python tah calls html file randomly. replace that with anythin we want.
> 
> zope rox! but i guess we all know that

Thanks, this was a nice briefing.
 
I like the demos, and as a single additional comment I would add that for
json-rpc I myself too made some (although more crude looking) simple
demos, that do not have a live server but that are installable: so that
you can start playing with it on your own server and modify any client or
server scripts, if you install the demo + jsonserver2 into Zope as two
individual products.

Downloads:

http://www.zope.org/Members/ree/jsonserver2_pkg/

Guide for the demos:

http://www.zope.org/Members/ree/jsonserver2_exa


-- 
Balazs Ree


___
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] Stepper 1.3.0 Released!

2005-10-11 Thread Chris Withers
Stepper is a framework for scripting and running asynchronous tasks on 
Zope servers.


This is a new release that adds support for Zope 2.8. It also fixes 
numerous small bugs and adds several minor new features.


For more information, please see:
http://www.simplistix.co.uk/software/zope/stepper

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] Zope Debugger lets WingDbg fail to connect toclient

2005-10-11 Thread Chris Withers

Hi Peter,

Frey, Peter wrote:


sorry, here it is. It is the the WingDbg Product, but you probably will be 
unable to install/use it as it depends on the WingIDE (at least part of it) to 
be installed on the server, too. And as WingIDE is not open source, I am not 
allowed to hand it on.


Yeah, I don't need it to run, just wanted to take a look.
The patching is a bit worse than I expected, it doesn't look like WinDbg 
makes any attempt to call back to the original version of the method 
it's patching, which is a bit sad :-(


That said, I'd expect zdb not to work when WinDbg is installed, and not 
the other way round...


I'm CC'ing in a support address I found for Wing-IDE in the hope that 
one of those guys will contact me. I believe zdb replaces a lot of the 
code they currently have in WingDbg, hopefully I can persuade them to 
use zdb instead, then everyone can be happy ;-)


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: Re: ZAjax anyone?

2005-10-11 Thread Greg Fischer
Ah even better!  Thanks guys.

I was going to reply just to mention I have a "not as cool" way of using Zope with Ajax at my site now too.

www.zajax.net

Seems every rock I turn over, I find 3 others worth
investigating.  Lots of cool stuff going on out there.  I put
up my own demo, but it's not nearly the prefered way of doing things by
most people.  I myself, prefer DTML over ZPT, so my demo is based
on that.  I also am using one of the larger client frameworks
available, Dojo Toolkit.  The js file is around 130k if I
remember.  The smaller ones are great and do the job, but I wanted
something larger and more widely used like Dojo to build off of.

I know eventually I'll look at the JSON stuff too.  Sound interesting.

GregOn 10/11/05, Balazs Ree <[EMAIL PROTECTED]> wrote:
On Mon, 10 Oct 2005 23:28:03 +0800 Bakhtiar A Hamid wrote:> we have zope (dtml/script/zsql-method) that do specific calls that spits> out results via xmlrpc.>> on the browser side, we have all these ajax libs - openrico, dojo,
> mochikits, azax, DataRequestor, jsolait, tim morgan's mini, etc>> we just need to connect the dots. the ajax lib + our java functions/etc> will call dtml/script/sql-method via xmlrpc(builtin) or jasonrpc(with the
> jsonrpc product) and page will be updated inline(?)>> not much voodo involved. everything is there already.>> a simple demo is at 
http://myzope.kedai.com.my/blogs/kedai/demo/; a script> python that just spits out DateTime().pCommon(), and the other, a script> python tah calls html file randomly. replace that with anythin we want.
>> zope rox! but i guess we all know thatThanks, this was a nice briefing.I like the demos, and as a single additional comment I would add that forjson-rpc I myself too made some (although more crude looking) simple
demos, that do not have a live server but that are installable: so thatyou can start playing with it on your own server and modify any client orserver scripts, if you install the demo + jsonserver2 into Zope as two
individual products.Downloads:http://www.zope.org/Members/ree/jsonserver2_pkg/Guide for the demos:
http://www.zope.org/Members/ree/jsonserver2_exa--Balazs Ree___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 )-- Greg Fischer1st Byte Solutions
http://www.1stbyte.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Zope Debugger 0.8.1 Released!

2005-10-11 Thread Chris Withers

This release adds support for both Zope 2.7 and Zope 2.8.

Zope Debugger is an enhanced version of pdb for use with Zope.

It can be used simply by inserting the following lines in any python
code you'd like to debug, including Script (Python)'s and FSPythonScripts:

from Products.zdb import set_trace
set_trace()

It requires no changes to Zope, CMF or Plone or any funky interaction
with any specific kind of editing software. All you really need to do is
insert the snippet above and make sure your Zope instance is running in
foreground mode.

For more information, please see:
http://www.simplistix.co.uk/software/zope/zdb

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] How to create a file and send it by e-mail ?

2005-10-11 Thread Nicolas Georgakopoulos
Hello all, I'm developing using ZPT and I need to create a file (CSV 
format) but I'm having some problems:


* 1. *I only know how to create files with python but I get an
*Error Type: NameError*
*Error Value: global name 'file' is not defined.

* I think ZOPE doe's not allow python to create files for security 
reasons. Can I change this security policy or it will make my 
application unsafe? Is there another way to create a file using ZOPE API 
calls ?


* 2.*When I create my file how can I send it as an attachment by mail ? 
(I already have setup my mail host object and I can send mail's 
successfully.)


thanks for your time..

*

*
___
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] How to create a file and send it by e-mail ?

2005-10-11 Thread Chris Withers

Nicolas Georgakopoulos wrote:
Hello all, I'm developing using ZPT and I need to create a file (CSV 
format) but I'm having some problems:


* 1. *I only know how to create files with python but I get an
*Error Type: NameError*
*Error Value: global name 'file' is not defined.


Indeed, just build your csv as a string :-)

* 2.*When I create my file how can I send it as an attachment by mail ? 
(I already have setup my mail host object and I can send mail's 
successfully.)


I just wrote a product specifically for this ;-)

http://www.simplistix.co.uk/software/zope/mailtemplates

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] How to create a file and send it by e-mail ?

2005-10-11 Thread Chris Withers

(please keep the list CC'ed in)

Nicolas Georgakopoulos wrote:

Chris Withers wrote:


Nicolas Georgakopoulos wrote:

Hello all, I'm developing using ZPT and I need to create a file (CSV 
format) but I'm having some problems:


* 1. *I only know how to create files with python but I get an
*Error Type: NameError*
*Error Value: global name 'file' is not defined.


Indeed, just build your csv as a string :-)



Yes I will build my csv as string but how can I save it as a file ?


Why do you think you need to?

Is the csv data dynamically generated?

If you need to store it, create a Zope File Object in the python script 
that processes submission from your ZPT.


* 2.*When I create my file how can I send it as an attachment by mail 
? (I already have setup my mail host object and I can send mail's 
successfully.)


I just wrote a product specifically for this ;-)

http://www.simplistix.co.uk/software/zope/mailtemplates


Thanks, I'm looking to it rigth now.


You'll want to build your own MIMEBase object and attach it to the 
result of rendering your Mail Template if you build your csv in a string.


If you end up with a Zope File object or a ZPublisher FileUpload object, 
then you can just do:


msg = context.my_mail_template.as_message(
 # insert your params here
 )

msg.add_file(your_file)

There's plenty of examples in the readme.txt file, or in the tests folder...

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] How to create a file and send it by e-mail ?

2005-10-11 Thread Tino Wildenhain

Nicolas Georgakopoulos schrieb:
Hello all, I'm developing using ZPT and I need to create a file (CSV 
format) but I'm having some problems:


* 1. *I only know how to create files with python but I get an
*Error Type: NameError*
*Error Value: global name 'file' is not defined.


While I wonder how do you create a file in python using file?

* I think ZOPE doe's not allow python to create files for security 
reasons. Can I change this security policy or it will make my 
application unsafe? Is there another way to create a file using ZOPE API 
calls ?


You dont need a real (filesystem-) file if all you want is sending it
over the net. Usually you just build a string - for example in python
scripts via print/return printed or as a list which you join.

* 2.*When I create my file how can I send it as an attachment by mail ? 
(I already have setup my mail host object and I can send mail's 
successfully.)


This is a bit more difficult, there are examples to send mails
with attachments per DTML, but if you want to avoid you either
open the python email package for python scripts or use
ChrisWs product (but I did not have the time to test it - so
try it :-)

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] proxy role for an external method

2005-10-11 Thread Reinoud van Leeuwen
On Tue, Oct 11, 2005 at 07:29:27AM +0100, Chris Withers wrote:
> Reinoud van Leeuwen wrote:
> >On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
> >
> >>Are you using CMF/Plone?
> >
> >
> >yes. the main part of the function is:
> >
> >   for brain in self.portal_catalog(portal_type='User',
> >SearchableText=SearchableText):
> >user = brain.getObject()
> >if user is None:
> >continue
> >results.append(getUserInfo(user))
> >
> >This works in a pyhton script but not in an external one
> 
> At this point I'd recommend my SainBrains product:
> http://www.simplistix.co.uk/software/zope/sanebrains
> 
> Then, change your user = line to:
> 
> user = brain._unrestrictedGetObject()

That is exactly what I need! Thanks!

I'll clean up the code and paste it here this afternoon so a working 
solution ends up in the archives. (I hate it to find discussions on google 
without the final solution to the problem ";-)
 

-- 
__
"Nothing is as subjective as reality"
Reinoud van Leeuwen[EMAIL PROTECTED]
http://www.xs4all.nl/~reinoud
__
___
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: Re: ZAjax anyone?

2005-10-11 Thread Jim Washington

Greg Fischer wrote:


Ah even better!  Thanks guys.

I was going to reply just to mention I have a "not as cool" way of 
using Zope with Ajax at my site now too.


www.zajax.net 

Seems every rock I turn over, I find 3 others worth investigating.  
Lots of cool stuff going on out there.  I put up my own demo, but it's 
not nearly the prefered way of doing things by most people.  I myself, 
prefer DTML over ZPT, so my demo is based on that.  I also am using 
one of the larger client frameworks available, Dojo Toolkit.  The js 
file is around 130k if I remember.  The smaller ones are great and do 
the job, but I wanted something larger and more widely used like Dojo 
to build off of.


I know eventually I'll look at the JSON stuff too.  Sound interesting.


Hi, Greg

Cool!  I like the way you do the how-to.  Do you plan similar how-tos 
for other JS libraries/techniques?  Would you accept contributions? I 
find myself looking at mochikit (http://mochikit.com) occasionally.  In 
its ajax-tables demo, it uses a tal(esque) syntax for dom manipulation 
in client javascript, which could be interesting for fans of page templates.


For the future, dare I ask, maybe some zope3 stuff?

I think the zope community really needs zope-oriented how-tos and 
evaluations of the various AJAX libraries.  zajax.net has the right name 
to be a prime focus of such activities, should you be willing to do that.


Thanks!

-Jim Washington

___
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] How to create a file and send it by e-mail ?

2005-10-11 Thread Chris Withers

Tino Wildenhain wrote:
This is a bit more difficult, 


Not anymore it's not!


there are examples to send mails
with attachments per DTML, 


yuckety yuk yuk...


but if you want to avoid you either
open the python email package 


...which MailTemplates lets you use in python scripts :-D


for python scripts or use
ChrisWs product (but I did not have the time to test it - so
try it :-)


Heh, well, it's been built to solve this exact problem, amoung others...

...if you're building email in Zope, you should be using MailTemplates!



cheers,

Chris - it solves world hunger, doncha know ;-)

--
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] Re: proxy role for an external method

2005-10-11 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jens Vagelpohl wrote:
> 
> On 10 Oct 2005, at 23:14, Peter Bengtsson wrote:
> 
>>> I understood that Plone does some extra magic, so I have to setup a
>>> securoty context... I'll post it here if I have a working solution
>>>
>>>
>> Shouldn't really be the problem. Isn't portal_catalog just another
>> ZCatalog that has nothing to do with Plone except it's located inside
>> a Plone instance.
> 
> 
> It *is* a problem. The reason is most likiely all the extra stuff the 
> catalog tool adds to the query before it reaches the actual catalog. 
> The workaround is something like this:
> 
> from Products.ZCatalog.ZCatalog import ZCatalog
> results = ZCatalog.searchResults(portal_catalog, **kws)
> 
> That way you circumvent any query munging done in the catalog tool 
> searchResults method, specifically the effective/expires and 
> allowedRolesAndUsers filtering.

CMF's CatalogTool grep an 'unrestrictedSearchResults' method which
does exactly that -- it can only be called from trusted code, but an
ExternalMethod certainly qualifies.


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

iD8DBQFDS7f5+gerLs4ltQ4RAhkSAKC7zy58wb+UmoiFb0e5fhCRB9SjSgCgzkRK
qIGTnVO1neNoaAD1hr9T/Og=
=T5H3
-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 )


[Zope] How to show the DTML Method's results within Plone?

2005-10-11 Thread Thomas Apostolou
Hello again...

i have a DTML Method like you can see bellow that
produces a table after quring some table (using python
GetHeader and GetData custom modules)
But the result is a table with the query results in
another page.
I would like to show the table with the query results
within Plone's enviroment.
How can i do this?

Thank you very much!!!





RE: [Zope] reading zope.config file for ClientStorage

2005-10-11 Thread Mika, David P (Research)
OK, the opts object really did have everything loaded.  On careful inspection 
the opts.configroot has an attribute "databases" with a list of 
Zope.Startup.datatypes.ZopeDatabase instances.  I can do what I originally set 
out to do which was to open a ZEO.ClientStorage configured from the 
zope-with-zeo.conf file (the ZEO.ClientStorage is now wrapped in a ZEOClient 
object):

from Zope.Startup import options, handlers
opts = options.ZopeOptions()
opts.configfile='c:\Zope-Instance-Test\etc\zope-with-zeo.conf'
opts.load_schema()
opts.load_configfile()
for db in opts.configroot.databases:
 if is instance(db.config.storage, ZODB.config.ZEOClient):
  db.config.storage.open()

>What does your zope-with-zeo.conf file look like?

My zope-with-zeo.conf file is pretty standard except for a designation to use a 
zeoclient.  I've also included a username and password as my zeo server is 
using digest authentication:

 
   mount-point /
   
 server localhost:8090
 storage 1
 name zeostorage
 var $INSTANCE/var
 username metalfor
 password my_zeo_cleartext_password
   
 


Thanks much!
Dave Mika
___
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] help with MailTemplates 1.0.0

2005-10-11 Thread Nicolas Georgakopoulos
I installed the MailTemplates product to Zope and try to run the example 
from the readme file:

--
Simple Example
 This example sends a simple templated mail to a specific
 address.
 Add the following to a Mail Template called my_mt:

 http://xml.zope.org/namespaces/tal";
 xmlns:metal="http://xml.zope.org/namespaces/metal";
 >Dear ,

  would like to thank you for
 your interest in:
 

 
  cheers,
 The Web Team
 

 Now add a Script (Python) in the same folder containing the
 following:

 container.my_mt(
 mfrom='[EMAIL PROTECTED]',
 mto='[EMAIL PROTECTED]',
 message='This is a test!'
 )

 return 'Mail Sent!'
--

 I cant make it work, when I try to test the python script I get a 
page like this :


Site Error

 An error was encountered while publishing this resource.
 
 
 

 Error Type: KeyError
 Error Value: u'option' 
 


can anyone give me a clue ?




___
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] How to show the DTML Method's results within Plone?

2005-10-11 Thread Peter Bengtsson
Try
https://lists.sourceforge.net/lists/listinfo/plone-users

2005/10/11, Thomas Apostolou <[EMAIL PROTECTED]>:
> Hello again...
>
> i have a DTML Method like you can see bellow that
> produces a table after quring some table (using python
> GetHeader and GetData custom modules)
> But the result is a table with the query results in
> another page.
> I would like to show the table with the query results
> within Plone's enviroment.
> How can i do this?
>
> Thank you very much!!!
>
>
> 
> 
> 

Re: [Zope] help with MailTemplates 1.0.0

2005-10-11 Thread Chris Withers

Nicolas Georgakopoulos wrote:
I installed the MailTemplates product to Zope and try to run the example 
from the readme file:

--
Simple Example
 This example sends a simple templated mail to a specific
 address.
 Add the following to a Mail Template called my_mt:

 http://xml.zope.org/namespaces/tal";
 xmlns:metal="http://xml.zope.org/namespaces/metal";
 >Dear ,

  would like to thank you for
 your interest in:
 

 


d'oh, that's a typo ;-)



I'll go and correct that in svn now :-)

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] help with MailTemplates 1.0.0

2005-10-11 Thread Chris Withers

(for the 2nd time, please keep this on the list...)
(just for the light on thinking, that means "hit reply all" or "make 
sure zope@zope.org is in the cc list)


Nicolas Georgakopoulos wrote:
Your documentation have anothe problem , you forgot to set a subject in 
your example :(


Oh dear, yes, I remember, I recently made subject required :-S
I'll have to fix that soon...


After I set a subject it say's :

Error Type: AttributeError
Error Value: 'str' object has no attribute '_send'
I don't know how to setup the _send attribute


Yes, and? Where's the rest of the traceback? I can't help you without it..

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] help with MailTemplates 1.0.0

2005-10-11 Thread Chris Withers

(sheesh, what is it with people, is 'reply all' that hard to find? ;-)

Tino Wildenhain wrote:




*yuck* tal to render plain text. Now thats ugly ;)


Suggest something better...

I find it convenient, especially for generating html mail, which 
customer have a habit of liking ;-)


On the development front, the fewer languages anyone needs to know to do 
development, the better. TAL/TALES works just as well here...


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] help with MailTemplates 1.0.0

2005-10-11 Thread Nicolas Georgakopoulos

Chris Withers wrote:


(for the 2nd time, please keep this on the list...)
(just for the light on thinking, that means "hit reply all" or "make 
sure zope@zope.org is in the cc list)


Sorry for that , it was on purpose.. I'm new to Zope and thought that it 
wasn't right to bother the rest of the list with my beginner problem...



Nicolas Georgakopoulos wrote:

Your documentation have anothe problem , you forgot to set a subject 
in your example :(



Oh dear, yes, I remember, I recently made subject required :-S
I'll have to fix that soon...


After I set a subject it say's :

Error Type: AttributeError
Error Value: 'str' object has no attribute '_send'
I don't know how to setup the _send attribute



Yes, and? Where's the rest of the traceback? I can't help you without 
it..


cheers,

Chris


Traceback (innermost last):

 Module ZPublisher.Publish, line 113, in publish
 Module ZPublisher.mapply, line 88, in mapply
 Module ZPublisher.Publish, line 40, in call_object
 Module Shared.DC.Scripts.Bindings, line 311, in __call__
 Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
 Module Products.PythonScripts.PythonScript, line 323, in _exec
 Module None, line 1, in mailAction.py
  - 
  - Line 1
 Module Products.MailTemplates.BaseMailTemplate, line 117, in send
 Module Products.MailTemplates.BaseMailTemplate, line 107, in _send
AttributeError: 'str' object has no attribute '_send'

Thank's for your help, looking forward to test your product tomorrow ;) (don't 
have more time for today)

___
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] How to create a file and send it by e-mail ?

2005-10-11 Thread Chris Withers

(yet again, please CC zope@zope.org in replies..)

Nicolas Georgakopoulos wrote:
I think I need it... 


I don't ;-)

I have made a web page (ZPT) that a user answer's 
to a questionnaire , most of the answers are provided by check boxes and 
radio buttons.
When the user submit the answers a mail is send with the answers by text 
in a string format like coma separated values.


You have a python script to do this, right?

The problem is that my client request to get the answer by mail with a 
file as an attachment so he can analyze the data with a statistical 
program SPSS.

Can this be done with Zope File Object ? (I don't think it can... )


You don't need a file object. Build the thing you want to send as a 
string called data, and have a string variable called filename 
containing the name you want to use for the attachment.


Then you need create a MIMEBase object for it:

# some imports
from email.MIMEBase import MIMEBase
from email import Encoders

# now create the attachment
msg = MIMEBase(maintype, subtype)
msg.set_payload(data)
Encoders.encode_base64(msg)
msg.add_header('Content-Disposition', 'attachment',
   filename=filename)

# now render the MailTemplate
wrapper = context.my_mail_template.as_message(
# insert params here
)
# finally, attach the file and send
wrapper.attach(msg)
wrapper.send()

You may also be interested in something I will likely add for the 1.1.0 
release:


https://secure.simplistix.co.uk/support/issue180

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] help with MailTemplates 1.0.0

2005-10-11 Thread Chris Withers

Nicolas Georgakopoulos wrote:


Sorry for that , it was on purpose.. I'm new to Zope and thought that it 
wasn't right to bother the rest of the list with my beginner problem...


The opposite is true.. by keeping this on the list, not only can other 
people help out, but other people can learn, and this becomes a resource 
for others once archived by google and gmane ;-)



 Module Products.MailTemplates.BaseMailTemplate, line 117, in send
 Module Products.MailTemplates.BaseMailTemplate, line 107, in _send
AttributeError: 'str' object has no attribute '_send'


Hmmm, what have you selected in the MailHost drop-down on the Mail 
Template's edit page?


Whatever you have selected is resolving to a string instead of a 
MailHost object :-S


cheers,

Chris

PS: What Zope version are you using?

--
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] help with MailTemplates 1.0.0

2005-10-11 Thread Nicolas Georgakopoulos

Chris Withers wrote:


Nicolas Georgakopoulos wrote:



Sorry for that , it was on purpose.. I'm new to Zope and thought that 
it wasn't right to bother the rest of the list with my beginner 
problem...



The opposite is true.. by keeping this on the list, not only can other 
people help out, but other people can learn, and this becomes a 
resource for others once archived by google and gmane ;-)



 Module Products.MailTemplates.BaseMailTemplate, line 117, in send
 Module Products.MailTemplates.BaseMailTemplate, line 107, in _send
AttributeError: 'str' object has no attribute '_send'



Hmmm, what have you selected in the MailHost drop-down on the Mail 
Template's edit page?


Whatever you have selected is resolving to a string instead of a 
MailHost object :-S


I have selected a Zope mailhost object



cheers,

Chris

PS: What Zope version are you using?


Zope-2.8.1-final
___
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] Error Type: ExpatError

2005-10-11 Thread Garito

Hi all

I try to read an xml file using
from xml.dom.minidom import parseString

It works fine but when I push the reload button raise these error

Error Type: ExpatError
Error Value: no element found: line 1, column 0

These error is intermittence

These is the trace back any idea?

Traceback (innermost last):

Module ZPublisher.Publish, line 113, in publish
111 |  missing_name,
112 |  dont_publish_class,
113>|  request, bind=1)
114 |
115 |if result is not response:

Module ZPublisher.mapply, line 88, in mapply
086 |
087 |args=tuple(args)
088>|if debug is not None: return debug(object,args,context)
089 |else: return object(*args)

Module ZPublisher.Publish, line 40, in call_object
038 |
039 |def call_object(object, args, request):
040>|result=apply(object,args) # Type s to step into published object.
041 |return result
042 |

Module Shared.DC.Scripts.Bindings, line 311, in __call__
309 |def __call__(self, *args, **kw):
310 |'''Calls the script.'''
311>|return self._bindAndExec(args, kw, None)
312 |
313 |def __render_with_namespace__(self, namespace):

Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
346 |exec bindcode
347 |bound_data = bound_data[0]
348>|return self._exec(bound_data, args, kw)
349 |finally:
350 |security.removeContext(self)

Module Products.PythonScripts.PythonScript, line 323, in _exec
321 |f = new.function(fcode, g, None, fadefs)
322 |
323>|result = f(*args, **kw)
324 |if keyset is not None:
325 |# Store the result in the cache.

Module None, line 9, in Lanzar
  -- Line 9
006 |if 'Camino' not in args: args['Camino'] = traverse_subpath
007 |if 'Usuario' not in args: args['Usuario'] = str(context.Dame('usuario'))
008>|args = context.ObtenerNodo(args)
009 |
010 |if args is None: 
Module Products.Yanged.SitioYanged, line 268, in ObtenerNodo

266 |   
267 |   if 'NodoRaiz' not in args:
268>|args['NodoRaiz'] = 
parseString(self.Dame({'nombre': self.getId() + '.mm'}).index_html(self.REQUEST, 
self.REQUEST.RESPONSE))
269 |   if 'Nodos' not in args: args['Nodos'] = 
args['NodoRaiz'].childNodes
270 |   if 'Nivel' not in args: args['Nivel'] = 0

Module xml.dom.minidom, line 1929, in parseString
1927 |if parser is None:
1928 |from xml.dom import expatbuilder
1929>|return expatbuilder.parseString(string)
1930 |else:
1931 |from xml.dom import pulldom

Module xml.dom.expatbuilder, line 940, in parseString
938 |else:
939 |builder = ExpatBuilder()
940>|return builder.parseString(string)
941 |
942 |

Module xml.dom.expatbuilder, line 223, in parseString
221 |parser = self.getParser()
222 |try:
223>|parser.Parse(string, True)
224 |self._setup_subset(string)
225 |except ParseEscape:
ExpatError: no element found: line 1, column 0



Thanks!

--
Mis Cosas
http://blogs.sistes.net/Garito/


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

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


Re: [Zope] help with MailTemplates 1.0.0

2005-10-11 Thread Chris Withers

Nicolas Georgakopoulos wrote:
Whatever you have selected is resolving to a string instead of a 
MailHost object :-S


I have selected a Zope mailhost object


Please explain exactly what you did, including how you create the 
MailHost, the Mail Template and the Python Script, in detail...


I just tried to reproduce this on a fresh Zope 2.8.1 instance and 
couldn't...


Using the first example, the mail rendered and sent just fine.

I'm still far from convinced the thing you think is a MailHost object is 
actually a MailHost object, did you perhaps delete or rename your 
MailHost object?


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: Re: ZAjax anyone?

2005-10-11 Thread Greg Fischer
Jim,

I am more than happy to take contributions from others.  Using
other libs or maybe even just some Zope techniques in general is
great.  Right now, I just loaded that stuff up over the last few
days, so it's quite limited.  But, if you have anything you would
like to share, please zip it up and email it over to me.  Just put
together all the html for the body, I'll post it for ya, with credit to
you of course.

I am sure that if I get a bunch of other how-tos to post, I will
probably have to grow things a bit, but it will evolve over time. 
All of this stuff is a learning process for me, so I wanted to put up
that site to share my experiences in hopes that others could benefit.

Zope 3, I would love to put stuff up for that, but I havent even
touched Zope 3 yet.  I am more than happy to put of info on that
as well.  

Thanks!

GregOn 10/11/05, Jim Washington <[EMAIL PROTECTED]> wrote:
Greg Fischer wrote:> Ah even better!  Thanks guys.>> I was going to reply just to mention I have a "not as cool" way of> using Zope with Ajax at my site now too.>> 
www.zajax.net >> Seems every rock I turn over, I find 3 others worth investigating.> Lots of cool stuff going on out there.  I put up my own demo, but it's
> not nearly the prefered way of doing things by most people.  I myself,> prefer DTML over ZPT, so my demo is based on that.  I also am using> one of the larger client frameworks available, Dojo Toolkit.  The js
> file is around 130k if I remember.  The smaller ones are great and do> the job, but I wanted something larger and more widely used like Dojo> to build off of.>> I know eventually I'll look at the JSON stuff too.  Sound interesting.
Hi, GregCool!  I like the way you do the how-to.  Do you plan similar how-tosfor other JS libraries/techniques?  Would you accept contributions? Ifind myself looking at mochikit (
http://mochikit.com) occasionally.  Inits ajax-tables demo, it uses a tal(esque) syntax for dom manipulationin client _javascript_, which could be interesting for fans of page templates.For the future, dare I ask, maybe some zope3 stuff?
I think the zope community really needs zope-oriented how-tos andevaluations of the various AJAX libraries.  zajax.net has the right nameto be a prime focus of such activities, should you be willing to do that.
Thanks!-Jim Washington-- Greg Fischer1st Byte Solutionshttp://www.1stbyte.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ODBC database adapter for zope2.8.1 on windows

2005-10-11 Thread Johan Carlsson

Andreas Jung wrote:

google for mxodbc

--On 10. Oktober 2005 16:37:45 +0530 Sreekanth S Rameshaiah 
<[EMAIL PROTECTED]> wrote:



Dear Friends,
Is there any good ODBC database adapter for zope2.8.1 on windows?
Thanks and Regards,
 - sree


Is there any free ODBC DA?
(Not necessary rock-solid-good, rather free.)

I didn't find any open source based while searching for one last week.

Regards,
Johan

--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM

___
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] ODBC database adapter for zope2.8.1 on windows

2005-10-11 Thread Andreas Jung



--On 11. Oktober 2005 19:08:53 +0200 Johan Carlsson 
<[EMAIL PROTECTED]> wrote:




Is there any free ODBC DA?
(Not necessary rock-solid-good, rather free.)


You can continue searching and trying for free alternative or just
spent some bucks for mxODBC..it's worth the money, it just works.
Maybe calculate your time you waste have wasted to so far for searching and 
trying ...


-aj

pgpdYxtRb3N0z.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] Zope security and packing the database

2005-10-11 Thread Cameron Beattie
I have created a script based on zope_pack from the Zope book which 
allows a username and password to be specified when it is called. I wish 
to create a user specifically for this purpose that only has the ability 
to pack the ZODB.


What permission is ZODB packing protected by?


I don't know. That's part of the problem. I can't see any permissions that 
allow or disallow this.


granted the backup role all available permissions. But the user can't 
login to http://mydomain.com/Control_Panel/Database/main/manage_workspace


I don't know what zope_pack looks like, can you show us?

vi zope_pack
#!/usr/bin/python
import sys, urllib
host = sys.argv[1]
days = sys.argv[2]
user = sys.argv[3]
pwd  = sys.argv[4]

class MyUrlOpener(urllib.FancyURLopener):
   def prompt_user_passwd(self, host, realm):
   return (user,pwd)
   def __init__(self, *args):
   self.version = "Zope Packer"
   urllib.FancyURLopener.__init__(self, *args)

def main():
   urllib._urlopener = MyUrlOpener()
   url = "%s/Control_Panel/Database/manage_pack?days:float=%s" % \
   (host, days)
   try:
   f = urllib.urlopen(url).read()
   except IOError:
   print "Cannot open URL %s, aborting" % url
   print "Successfully packed ZODB on host %s" % host
if __name__ == '__main__':
   main()


What error message do you get?


If I use a user that has the Owner role it works correctly.

If I use the backup user then urllib can't get the url due to no 
authentication so errors as follows:

 File "/usr/lib/python2.4/urllib.py", line 180, in open
   return getattr(self, name)(url)
 File "/usr/lib/python2.4/urllib.py", line 305, in open_http
   return self.http_error(url, fp, errcode, errmsg, headers)
 File "/usr/lib/python2.4/urllib.py", line 318, in http_error
   result = method(url, fp, errcode, errmsg, headers)
 File "/usr/lib/python2.4/urllib.py", line 615, in http_error_401
   return getattr(self,name)(url, realm)
 File "/usr/lib/python2.4/urllib.py", line 628, in retry_http_basic_auth
   return self.open(newurl)


Any tracebacks?


Nothing appears in the log.


PS: I wouldn't do zodb packing by whacking a url. There's a script that 
scripts with ZOpe now that opens up a ZEO connection and does the pack 
that way, that's what I'd do...


I don't use ZEO - can I just do the scripted packing bit without all the 
associated ZEO setup?


Regards

Cameron 


___
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 )