Re: [Zope3-Users] newbie problems with new content-type

2006-02-09 Thread Lorenzo Gil Sanchez

[EMAIL PROTECTED] wrote:


'test' command searches only packages under instance_lib.
and instance_lib is 'c:\path\to\your\instance\lib\python'



Ok, that's my problem. My package was outside the instance lib 
directory. I think I have read in the Zope Developers Book that you 
could put your application anywhere in your harddisk as long as 
PYTHONPATH includes it.


Now, the tests are found.

Thanks a lot Katsutoshi

Cheers

Lorenzo
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie problems with new content-type

2006-02-09 Thread wata
 
 Ok, that's my problem. My package was outside the instance lib 
 directory. I think I have read in the Zope Developers Book that you 
 could put your application anywhere in your harddisk as long as 
 PYTHONPATH includes it.
 


I understand that. a month ago I was in the same situation
as you are now. I also couldn't a unit test to work. so
I read the source code of 'test' command.

As mentioned often before here, Stephan's book is somewhat outdated.
You should be aware of that.

regards


Watanabe, Katsutoshi

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie problems with new content-type

2006-02-08 Thread Lorenzo Gil Sanchez

Chris Withers wrote:

Lorenzo Gil Sanchez wrote:

c:\path\to\my\instance\bin\test -vpu --dir z:\my_root_app_dir
[ traceback ]
ImportError: No module named z:.my_root_app_dir


Is my_root_app_dir on your PYTHON_PATH?


Yes it is


also, do you have __init__.py files in \tests?


Yes I do



If you have, you should be able to do:

c:\path\to\my\instance\bin\test -vpu tests



c:\zope\development\bin\test -vpu tests
Running tests at level 1
Total: 0 tests, 0 failures, 0 errors

No tests are found :(

Thanks anyway

Lorenzo

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] newbie problems with new content-type

2006-02-06 Thread Lorenzo Gil Sanchez

Hi,

I'm trying to get my first content-type working and I have some 
problems. For the record, I'm following Stephan great book and I'm 
running Zope 3.2.0 on Windows.


My content-type represents a Provider and is quite simple. The first 
problem I have is when I try to run the tests with the following code:


c:\path\to\my\instance\bin\test -vpu --dir z:\my_root_app_dir
[ traceback ]
ImportError: No module named z:.my_root_app_dir

So I go to the z:\ dir and try another form:

c:\path\to\my\instance\bin\test -vpu --dir my_root_app_dir
Running tests at level 1
Total: 0 tests, 0 failures, 0 errors


So no tests found. But when I run this command:

Z:\c:\python24\python my_root_app_dir\tests\test_provider.py
.
--
Ran 1 test in 0.010s

OK

It *runs* 1 test. What am I doing wrong?

Second question: When I register my content-type in Zope using a 
configure.zcml in the root directory and a browser package with its own 
configure.zcml everything seems to work fine. I can see an entry in the 
Add menu for my content type.


When I click on that entry I see a nice autogenerated form for the 
Provider. I fill some fields and click the Add button and then I get a 
security exception:


ForbiddenAttribute: ('name', my_root_app_dir.provider.Provider object 
at 0x034A2730)


I'm logging in as the only principal in my zope instance which is the 
one created with the mkzopeinstance script. In the configure.zcml file 
of the browser subpackage I have this code:


  addform
  label=Add Provider
  name=AddProvider.html
  schema=my_root_app_dir.interfaces.IProvider
  content_factory=my_root_app_dir.provider.Provider
  fields=name phone address email
  permission=zope.ManageContent
  /

Any help is greatly appreciated.

Thanks

Lorenzo Gil
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] newbie problems with new content-type

2006-02-06 Thread Lorenzo Gil Sanchez

Christoph Frick wrote:

On Mon, Feb 06, 2006 at 06:48:30PM +0100, Lorenzo Gil Sanchez wrote:


c:\path\to\my\instance\bin\test -vpu --dir z:\my_root_app_dir
[ traceback ]
ImportError: No module named z:.my_root_app_dir


dunnonothing about windows - but either the test-environment can not
handle the leading letter: or a relative path is expected.


Yeah, that's what I though so I try executing it with relative paths as 
you can see from my second try (in the original message).




ForbiddenAttribute: ('name', my_root_app_dir.provider.Provider object 
at 0x034A2730)


  addform
  label=Add Provider
  name=AddProvider.html
  schema=my_root_app_dir.interfaces.IProvider
  content_factory=my_root_app_dir.provider.Provider
  fields=name phone address email
  permission=zope.ManageContent
  /


is it possible you forgot to provide permissions for setting the schema?

content class=.provider.Provider
implements
interface=zope.app.annotation.IAttributeAnnotatable /
require permission=zope.View
			interface=.interface.IProvider 
		/

require permission=zope.ManageContent
set_schema=.interfaces.IProvider
/
/content

where interface.IProvider should have an attribute ``name''.



Thanks a lot Christoph. That was exactly my problem. It's great to have 
so fast feedback.


Lorenzo






___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users