Re: [Zope] error trying to import smtplib (unauthorized)

2005-10-14 Thread Nicolas Georgakopoulos

Chris Withers wrote:


Nicolas Georgakopoulos wrote:

I will try VerboseSecurity for a last chance ... if it doesn't work I 
will install the lates Zope release.



No, you haven't anyway taken me through, step by step, what you've 
done to get where you are...


What release of Zope are you using?

Chris

I unistall zope and install it again with version Zope-2.8.2-final and 
put your product on C:\Zope-Instance\Products\MailTemplates


I run Zope with admin priviledges and :

1.Created a folder with id MailTesting on the root.

2.Created a MailHost object with id MailHost inside MailTesting folder.

3.Created a MailTemplate object with the id my_mt and selected my 
MailHost object (from step 2) inside MailTesting folder.


4.Created a python script inside MailTesting folder with the id 
send_mail and change your code only in the part : 
mto=('[EMAIL PROTECTED]',[EMAIL PROTECTED]), --  mto='[EMAIL PROTECTED]',


5.Created a file with the id  myfile.bin and loaded a txt file inside 
MailTesting folder.


6.Have changed in _all objects_ and in the _folder_ the _permissions_ on 
the security tab of each one (_I checked all the checkboxes!!!_)


7.Try to run the python script from the test tab ...  :
It prompt for user name and password.
User name and password given correct and it keep prompting the same.
Some how this action log me out from Zope.

8.To check the error log I must log in again.There are 2 errors :

A) admin (admin)  Unauthorized: You are not allowed to access 'add_file' 
in this context  
(when I was trying to test the script with my account )


B) Anonymous User (None) Unauthorized: strongYou are not authorized to 
access this resource./strong  
(when I log on again to see the error log)


traceback for A:
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 6, in send_mail
  - PythonScript at /MailTesting/send_mail
  - Line 6
Unauthorized: You are not allowed to access 'add_file' in this context

traceback for B:
Traceback (innermost last):
 Module ZPublisher.Publish, line 104, in publish
 Module ZPublisher.BaseRequest, line 461, in traverse
 Module ZPublisher.HTTPResponse, line 684, in unauthorized
Unauthorized: strongYou are not authorized to access this 
resource./strong


9.If I press cancel when I run the python script your product show me 
this error message:


strongError Type: Unauthorized/strongbr/
strongError Value: You are not allowed to access 'add_file' in this 
context/strongbr/ 



Is that what you want ?

I will install VerboseSecurity (my last hope)

c u ...
___
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] error trying to import smtplib (unauthorized)

2005-10-14 Thread Jens Vagelpohl


On 14 Oct 2005, at 10:41, Nicolas Georgakopoulos wrote:
Sorry for the delay Chris but I read some where that  
VerboseSecurity is made only for Zope 2.7 and some users recommend  
not to install that product because it changes the security  
policies of zope with the authors ...


VerboseSecurity is *integrated* into Zope after 2.8, you don't  
install it separately. You enable it in zope.conf, see the verbose- 
security option.


jens

___
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] error trying to import smtplib (unauthorized)

2005-10-14 Thread Jens Vagelpohl


On 14 Oct 2005, at 11:02, Nicolas Georgakopoulos wrote:
VerboseSecurity is *integrated* into Zope after 2.8, you don't   
install it separately. You enable it in zope.conf, see the  
verbose- security option.


jens


Thank's Jens I didn't know that. I find it verbose- security   
option in the zope.conf only as an example. Where and how exactly  
you change that?


Please stay on the list. If you want a personal helpdesk I'm glad to  
do it, for money.


The option is not only as an example, it is commented out and thus  
deactivated. Uncomment it.


jens

___
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] error trying to import smtplib (unauthorized)

2005-10-14 Thread Chris Withers

Nicolas Georgakopoulos wrote:


FINALLY it work's! I installed VerboseSecurity and repeat the same 
action'sit just work.


Right, well, that's not good news ;-)
As Jens pointed out VerboseSecurity shouldn't be installed in 2.8, which 
I only just found out...


The fact that it makes things work is... interesting.

Anyway, I can now reproduce the issue, and I know what it is, so I'll 
see if I can get it fixed some time soon...


cheers, and thanks for putting up with me trying ot find out what's wrong...

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] error trying to import smtplib (unauthorized)

2005-10-14 Thread Nicolas Georgakopoulos

Chris Withers wrote:


Nicolas Georgakopoulos wrote:



FINALLY it work's! I installed VerboseSecurity and repeat the same 
action'sit just work.



Right, well, that's not good news ;-)
As Jens pointed out VerboseSecurity shouldn't be installed in 2.8, 
which I only just found out...


The fact that it makes things work is... interesting.

Anyway, I can now reproduce the issue, and I know what it is, so I'll 
see if I can get it fixed some time soon...


cheers, and thanks for putting up with me trying ot find out what's 
wrong...


Chris


thank you for your support !

keep the good work.

thank's again.
___
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] error trying to import smtplib (unauthorized)

2005-10-14 Thread Chris Withers

Hi Nicolas,

Nicolas Georgakopoulos wrote:


thank you for your support !


Right, I'm not gonna get to do a new release as soon as I'd like since 
there are a few more issues I want to solve. However, as the one you 
found is a bit of a showstopper as far as using MailTemplates to send 
attachments is concerned, please find attached a patch for 
MTMultipart.py that will solve the problem for the time being...


I've also opened an issue for this in the support system:
https://secure.simplistix.co.uk/support/issue184

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] error trying to import smtplib (unauthorized)

2005-10-13 Thread David Convent

Python scripts are run in a restricted environment,
move your code to either an external method or a python zope product 
built on the filesystem


Nicolas Georgakopoulos wrote:


Trying to execute the following code from a python script

from smtplib import SMTP
from email.MIMEText import MIMEText

I get a error:

*Error Type: ImportError*
*Error Value: import of SMTP from smtplib is unauthorized. You are 
not allowed to access 'SMTP' in this context

*
Why I can't access SMTP if I am a user manager with all the access 
enabled for managers in the current context ?

___
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 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] error trying to import smtplib (unauthorized)

2005-10-13 Thread Chris Withers

Nicolas Georgakopoulos wrote:

Trying to execute the following code from a python script

from smtplib import SMTP
from email.MIMEText import MIMEText

I get a error:

*Error Type: ImportError*
*Error Value: import of SMTP from smtplib is unauthorized. You are 
not allowed to access 'SMTP' in this context

*
Why I can't access SMTP if I am a user manager with all the access 
enabled for managers in the current context ?


*continues banging head against brick wall*

Because it has no security declarations. If you bothered to install 
VerboseSecurity it would have told you this...


MailHosts are how you send mail in Zope...

MailTemplates are what you want to use, I still don't understand why 
you're having so many problems, I simply cannot reproduce what you're 
seeing...


Start with a fresh, clean Zope instance and tell me the steps you go 
(every single one of them!) through to get to the point where you can 
try the python script and get the errors you were complaining about 
before...


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] error trying to import smtplib (unauthorized)

2005-10-13 Thread Nicolas Georgakopoulos

David Convent wrote:


Python scripts are run in a restricted environment,
move your code to either an external method or a python zope product 
built on the filesystem


How can I move the code to another python zope product ?
___
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] error trying to import smtplib (unauthorized)

2005-10-13 Thread Chris Withers

Nicolas Georgakopoulos wrote:
I will try VerboseSecurity for a last chance ... if it doesn't work I 
will install the lates Zope release.


No, you haven't anyway taken me through, step by step, what you've done 
to get where you are...


What release of Zope are you using?

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] error trying to import smtplib (unauthorized)

2005-10-13 Thread Nicolas Georgakopoulos

Chris Withers wrote:


Nicolas Georgakopoulos wrote:

I will try VerboseSecurity for a last chance ... if it doesn't work I 
will install the lates Zope release.



No, you haven't anyway taken me through, step by step, what you've 
done to get where you are...


What release of Zope are you using?

Chris


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