Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 00:58 schrieb Alen Stanisic:
 On Sat, 2006-02-11 at 00:44 +0100, Florian Lindner wrote:
  I get a system error:
 
  2006-02-11T00:41:25 ERROR SiteError
  http://horus:8080/++skin++centershock/cs/registrationForm.html
  Traceback (most recent call last):
File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in
  publish
  result = publication.callObject(request, object)
File /home/florian/Zope3/src/zope/app/publication/zopepublication.py,
  line 161, in callObject
  return mapply(ob, request.getPositionalArguments(), request)
File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in
  mapply
  return debug_call(object, args)
File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in
  debug_call
  return object(*args)
File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in
  __call__ self.update()
File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in
  update self.setUpWidgets()
File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in
  setUpWidgets
  adapters=self.adapters, ignore_request=ignore_request
File /home/florian/Zope3/src/zope/formlib/form.py, line 337, in
  setUpEditWidgets
  field = form_field.field
  AttributeError: 'str' object has no attribute 'field'
  127.0.0.1 - - [11/Feb/2006:00:41:25 +0200]
  GET /++skin++centershock/cs/registrationForm.html HTTP/1.1 500 89 -
  Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.3 (like Gecko)
 
 
 
  I get it now with EditForm too (the backtrace above was produced with
  EditForm) I think I had a typo that caused the 404 in my last post,
  sorry!.
 
  Florian

 In your view.py is the syntax when you set form_fields valid, I haven't
 seen it before:

 form_fields = IRegistrationForm

 I usually do it by

 (from zope.formlib import form)
 form_fields = form.Fields(IRegistrationForm)

I've changed it to:

class registrationForm(form.EditForm):
form_fields = form.Fields(IRegistrationForm)


but that gives a system error:

2006-02-11T10:07:02 ERROR SiteError 
http://horus:8080/++skin++centershock/cs/registrationForm.html
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in 
publish
result = publication.callObject(request, object)
  File /home/florian/Zope3/src/zope/app/publication/zopepublication.py, line 
161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in 
mapply
return debug_call(object, args)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in 
debug_call
return object(*args)
  File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in __call__
self.update()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in update
self.setUpWidgets()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in 
setUpWidgets
adapters=self.adapters, ignore_request=ignore_request
  File /home/florian/Zope3/src/zope/formlib/form.py, line 373, in 
setUpEditWidgets
value = field.get(adapter)
  File /home/florian/Zope3/src/zope/schema/_bootstrapfields.py, line 171, in 
get
return getattr(object, self.__name__)
ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock 
object at 0xb757a46c)


blablubb is a field of my interface.


Any idea? Missing security declarations?

Thanks,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Helmut Merz
Am Freitag, 10. Februar 2006 22:18 schrieb Florian Lindner:

 in configure.zcml:
...
 name=registrationForm.html

 And I try to call it with:

 /++skin++centershock/cs/registerForm.html

Is this really your code (registrationForm.html vs. 
registerForm.html)? Then a 404 shouldn't be a surprise ;-)

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Alen Stanisic
On Sat, 2006-02-11 at 10:10 +0100, Florian Lindner wrote:
 ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock 
 object at 0xb757a46c)
 
 
 blablubb is a field of my interface.
 
 
 Any idea? Missing security declarations?
 

Hmm.. not sure..  maybe the permission in your zcml content definition
for your Centershock object:


content class=Centershock
.
.
require
permission=???
interface=...ICentershock
/
.
.
.
/content


Alen

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 10:38 schrieb Alen Stanisic:
 On Sat, 2006-02-11 at 10:10 +0100, Florian Lindner wrote:
  ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock
  object at 0xb757a46c)
 
 
  blablubb is a field of my interface.
 
 
  Any idea? Missing security declarations?

 Hmm.. not sure..  maybe the permission in your zcml content definition
 for your Centershock object:


 content class=Centershock
 .
 .
 require
   permission=???
   interface=...ICentershock
   /
 .
 .
 .
 /content

I've changed it to:

 require permission=zope.Public interface=.interfaces.ICentershock /
 require permission=zope.Public set_schema=.interfaces.ICentershock /


and it's still the same...  :-(

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 10:18 schrieb Helmut Merz:
 Am Freitag, 10. Februar 2006 22:18 schrieb Florian Lindner:
  in configure.zcml:

 ...

  name=registrationForm.html
 
  And I try to call it with:
 
  /++skin++centershock/cs/registerForm.html

 Is this really your code (registrationForm.html vs.
 registerForm.html)? Then a 404 shouldn't be a surprise ;-)

Yes, that was my fault. I've this registerForm.html in my history and tend to 
select it accidently. But it's still a error:

2006-02-11T10:04:48 ERROR SiteError 
http://horus:8080/++skin++centershock/cs/registrationForm.html
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in 
publish
result = publication.callObject(request, object)
  File /home/florian/Zope3/src/zope/app/publication/zopepublication.py, line 
161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in 
mapply
return debug_call(object, args)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in 
debug_call
return object(*args)
  File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in __call__
self.update()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in update
self.setUpWidgets()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in 
setUpWidgets
adapters=self.adapters, ignore_request=ignore_request
  File /home/florian/Zope3/src/zope/formlib/form.py, line 337, in 
setUpEditWidgets
field = form_field.field
AttributeError: 'str' object has no attribute 'field'


when using form_fields = IRegistrationForm. 
If I change it to form_fields = form.Fields(IRegistrationForm) like proposed 
in another mail I get another error:

2006-02-11T10:07:02 ERROR SiteError 
http://horus:8080/++skin++centershock/cs/registrationForm.html
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in 
publish
result = publication.callObject(request, object)
  File /home/florian/Zope3/src/zope/app/publication/zopepublication.py, line 
161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in 
mapply
return debug_call(object, args)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in 
debug_call
return object(*args)
  File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in __call__
self.update()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in update
self.setUpWidgets()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in 
setUpWidgets
adapters=self.adapters, ignore_request=ignore_request
  File /home/florian/Zope3/src/zope/formlib/form.py, line 373, in 
setUpEditWidgets
value = field.get(adapter)
  File /home/florian/Zope3/src/zope/schema/_bootstrapfields.py, line 171, in 
get
return getattr(object, self.__name__)
ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock 
object at 0xb757a46c)


blablubb is a field of my interface.



Regards,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Garanin Michael
   File /home/florian/Zope3/src/zope/schema/_bootstrapfields.py, line 171, 
 in 
 get
 return getattr(object, self.__name__)
 ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock 
 object at 0xb757a46c)
 
That is problem? You object don't have '__name__' attribute. 
See 'buddydemo.Buddy' please.  
There are two variants:
1) in MyClass write ' __name__ = __parent__ = None'
2) or MyClass must implement ILocation

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Helmut Merz
Am Samstag, 11. Februar 2006 11:21 schrieb Florian Lindner:
 Am Samstag, 11. Februar 2006 10:18 schrieb Helmut Merz:

  Is this really your code (registrationForm.html vs.
  registerForm.html)? Then a 404 shouldn't be a surprise ;-)

 Yes, that was my fault. I've this registerForm.html in my
 history and tend to select it accidently. 

Ah, sorry, I missed this info in your previous post...

...
 If I change it to form_fields = form.Fields(IRegistrationForm)
 like proposed in another mail 

That's the correct way to do it anyway (see 
zope/formlib/form.txt).

 I get another error: 
...
   File
 /home/florian/Zope3/src/zope/schema/_bootstrapfields.py,
 line 171, in get
 return getattr(object, self.__name__)
 ForbiddenAttribute: ('blablubb',
 CS.centershock.centershock.Centershock object at 0xb757a46c)

 blablubb is a field of my interface.

Of which interface? IRegistrationForm only or also ICentershock? 
(and no typos? ;-))

If it's in ICentershock and you have something like

content class=CS.centershock.centershock.Centershock ...  
  require permission=zope.Public
   interface=.interfaces.ICentershock / 
  require permission=zope.Public
   set_schema=.interfaces.ICentershock /
/content 

in configure.zcml (and Centershock implements ICentershock, of 
course) then you really shouldn't get the ForbiddenAttribute 
error.

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 12:44 schrieb Helmut Merz:
 Am Samstag, 11. Februar 2006 11:21 schrieb Florian Lindner:
  Am Samstag, 11. Februar 2006 10:18 schrieb Helmut Merz:
   Is this really your code (registrationForm.html vs.
   registerForm.html)? Then a 404 shouldn't be a surprise ;-)
 
  Yes, that was my fault. I've this registerForm.html in my
  history and tend to select it accidently.

 Ah, sorry, I missed this info in your previous post...

 ...

  If I change it to form_fields = form.Fields(IRegistrationForm)
  like proposed in another mail

 That's the correct way to do it anyway (see
 zope/formlib/form.txt).

  I get another error:

 ...

File
  /home/florian/Zope3/src/zope/schema/_bootstrapfields.py,
  line 171, in get
  return getattr(object, self.__name__)
  ForbiddenAttribute: ('blablubb',
  CS.centershock.centershock.Centershock object at 0xb757a46c)
 
  blablubb is a field of my interface.

 Of which interface? IRegistrationForm only or also ICentershock?
 (and no typos? ;-))

of IRegistrationForm and not of ICentershock

 If it's in ICentershock and you have something like

 content class=CS.centershock.centershock.Centershock ...
   require permission=zope.Public
    interface=.interfaces.ICentershock /
   require permission=zope.Public
    set_schema=.interfaces.ICentershock /
 /content

 in configure.zcml (and Centershock implements ICentershock, of
 course) then you really shouldn't get the ForbiddenAttribute
 error.

I have that declaration for ICentershock. I've no declaration for 
IRegistrationForm.

Note that I don't want to edit an ICentershock object, I don't want to edit 
any kind of object. I just want to create a form based on a schema. The 
schema has no use but to provide the fields information for the form. The 
processing of the data entered is done manually in python code.

registrationForm.html is not a view on a Centershock object. It should be a 
form in which the user can enter data that is being processed by the view 
class and ultimately create an user in a PAU utility. The ICentershock 
objects should server as a kind of root object of my application, the object 
that provided all the pages that can't be assigned to an instance of an 
object (like contact information or the powered by Zope page).

Regards,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 11:59 schrieb Garanin Michael:
File /home/florian/Zope3/src/zope/schema/_bootstrapfields.py, line
  171, in get
  return getattr(object, self.__name__)
  ForbiddenAttribute: ('blablubb', CS.centershock.centershock.Centershock
  object at 0xb757a46c)

 That is problem? You object don't have '__name__' attribute.
 See 'buddydemo.Buddy' please.
 There are two variants:
 1) in MyClass write ' __name__ = __parent__ = None'
 2) or MyClass must implement ILocation

What is MyClass in this context? The interface, the view class, or the class 
that contains it?

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Helmut Merz
Am Samstag, 11. Februar 2006 14:11 schrieb Florian Lindner:

   blablubb is a field of my interface.
 
  Of which interface? IRegistrationForm only or also
  ICentershock? (and no typos? ;-))

 of IRegistrationForm and not of ICentershock

I see...   Seems to be OK for what you're wanting to do.

 Note that I don't want to edit an ICentershock object, I don't
 want to edit any kind of object. I just want to create a form
 based on a schema. The schema has no use but to provide the
 fields information for the form. The processing of the data
 entered is done manually in python code.

 registrationForm.html is not a view on a Centershock object.
 It should be a form in which the user can enter data that is
 being processed by the view class and ultimately create an
 user in a PAU utility. The ICentershock objects should server
 as a kind of root object of my application, the object that
 provided all the pages that can't be assigned to an instance
 of an object (like contact information or the powered by Zope
 page).

OK, but for EditForm you need an object the fields of the form 
can be bound to. If that's not a content object it could just be 
an adapter.

Another and probably better way in this case would be not to 
derive from EditForm but from Form.

I just have to solve a similar problem and got it working the 
following way (IPersonRegistration is the schema for the form, 
INode is the interface of something like your Centershock 
object):

browser/configure.zcml:

  browser:page 
  name=registration.html
  for=..interfaces.INode
  class=.registration.PersonRegistrationView
  permission=zope.Public /


browser/registration.py:

from zope.formlib.form import Form, FormFields, action
from zope.formlib.i18n import _

class PersonRegistrationView(EditForm):

form_fields = FormFields(IPersonRegistration)

@action(_(Apply))
def handle_edit_action(self, action, data):
print data # here we'll do the real stuff...


As often with Zope 3: simple but not easy (to find out) ;-)

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 16:51 schrieb Helmut Merz:
 Am Samstag, 11. Februar 2006 14:11 schrieb Florian Lindner:
blablubb is a field of my interface.
  
   Of which interface? IRegistrationForm only or also
   ICentershock? (and no typos? ;-))
 
  of IRegistrationForm and not of ICentershock

 I see...   Seems to be OK for what you're wanting to do.

  Note that I don't want to edit an ICentershock object, I don't
  want to edit any kind of object. I just want to create a form
  based on a schema. The schema has no use but to provide the
  fields information for the form. The processing of the data
  entered is done manually in python code.
 
  registrationForm.html is not a view on a Centershock object.
  It should be a form in which the user can enter data that is
  being processed by the view class and ultimately create an
  user in a PAU utility. The ICentershock objects should server
  as a kind of root object of my application, the object that
  provided all the pages that can't be assigned to an instance
  of an object (like contact information or the powered by Zope
  page).

 OK, but for EditForm you need an object the fields of the form
 can be bound to. If that's not a content object it could just be
 an adapter.

 Another and probably better way in this case would be not to
 derive from EditForm but from Form.

 I just have to solve a similar problem and got it working the
 following way (IPersonRegistration is the schema for the form,
 INode is the interface of something like your Centershock
 object):

 browser/configure.zcml:

   browser:page
   name=registration.html
   for=..interfaces.INode
   class=.registration.PersonRegistrationView
   permission=zope.Public /


 browser/registration.py:

 from zope.formlib.form import Form, FormFields, action
 from zope.formlib.i18n import _

 class PersonRegistrationView(EditForm):

 form_fields = FormFields(IPersonRegistration)

 @action(_(Apply))
 def handle_edit_action(self, action, data):
 print data # here we'll do the real stuff...


 As often with Zope 3: simple but not easy (to find out) ;-)

I couldn't express it better...

Thanks a lot, it works now!

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Florian Lindner
Am Samstag, 11. Februar 2006 16:40 schrieb Garanin Michael:
  I still don't understand why it's necessary that the content object needs
  to implement or be adaptable to the schema from which the form is
  generated.
 
 
  Florian

 It's normal and it's right: content object MUST be adaptable to
 shema-interface. It's 'components world' ;-)

No, you misunderstood me. The IRegistrationForm interface has nothing to do 
with the ICentershock interface.
Look at the recend email from Helmut Merz [EMAIL PROTECTED] in this thread. 
He 
did exactly what I want and it works without an implements.

Thanks a lot for your help!

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-11 Thread Lennart Regebro
 Look at the recend email from Helmut Merz [EMAIL PROTECTED] in this thread. 
 He
 did exactly what I want and it works without an implements.

Yes, because he is not using browser:form.

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 11:37 schrieb Lennart Regebro:
 On 2/10/06, Florian Lindner [EMAIL PROTECTED] wrote:
  It does not implement registrationForm. But I thought that
  interfaces.registrationForm is only for providing the schema to build the
  form, because of the for=* it should displayable from all objects. Or
  not?

 Right, but when you try to display a page that uses a schema for an
 object that does not implement that schema, it tries to look up an
 adapter between the object and the schema. And if that fails, the page
 will not be displayed. I suspect that may be the reason. Try to not
 define the schema and see if the page shows up.

I don't think that you're right...

Anyway, I tried it:
The schema is required, I can't leave it undefined. I've changed it to:

schema=CS.centershock.interfaces.ICentershock

And called ++skin++centershock/cs/registerForm.html. cs is an object that does 
implement ICentershock. I've also tried to set for on the same value as 
schema or omitting it. Everything gave the same result: 404.

Any more ideas?

Thanks,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Donnerstag, 9. Februar 2006 22:45 schrieb Bernd Dorn:
 On 09.02.2006, at 19:27, Florian Lindner wrote:
  Hello,
  I try to create a form build from a schema with browser:form:
 
  form
  name=registrationForm.html
  schema=.interfaces.registrationForm
  class=.views.registrationForm
  permission=zope.Public
  layer=centershock
  for=*/
 
 
 
  interfaces.registrationForm looks like that:
 
  from zope.interface import Interface
  from zope.schema import TextLine, Password
  class registrationForm(Interface):
  login = TextLine(title=uUsername)
 
 
  views.registrationForm:
 
  class registrationForm(object):
  def __init__(self):
  import pdb; pdb.set_trace()
  def getData(self):
  import pdb; pdb.set_trace()
  def setData(self):
  import pdb; pdb.set_trace()
 
  but when I try to call the URL:
  http://horus:8080/++skin++centershock/registrationForm.html I just
  get 404.

 maybe http://horus:8080/++skin++Centershock/registrationForm.html

 skin names are CamelCase per convention and layers lowercase

Not in my convention  ;-)

The skin is applied correctly, the 404 error page is rendered with my skin.

Regards,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
Do you register the 'centershock'skin? 
Write this part of zcml-code, please.


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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 14:05 schrieb Garanin Michael:
 Do you register the 'centershock'skin?
 Write this part of zcml-code, please.

Yes, there are a number of page directives that use the centershock skin and 
are working correctly.

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
В Птн, 10/02/2006 в 14:22 +0100, Florian Lindner пишет:
 Am Freitag, 10. Februar 2006 14:05 schrieb Garanin Michael:
  Do you register the 'centershock'skin?
  Write this part of zcml-code, please.
 
 Yes, there are a number of page directives that use the centershock skin and 
 are working correctly.
 
 Florian
Do you include 'default'-layer to 'centershock'-skin definition?
I think 'browser:form' ignore 'layer'-attribute and use
'default'-layer. 





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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Lennart Regebro
On 2/10/06, Florian Lindner [EMAIL PROTECTED] wrote:
  Right, but when you try to display a page that uses a schema for an
  object that does not implement that schema, it tries to look up an
  adapter between the object and the schema. And if that fails, the page
  will not be displayed. I suspect that may be the reason. Try to not
  define the schema and see if the page shows up.

 I don't think that you're right...

I think I am. :-)

 Anyway, I tried it:
 The schema is required, I can't leave it undefined. I've changed it to:

Right, of course, it's a form...
If you try browser:page instead of browser:form, does it work then?

--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
I simulate this for Buddy from buddydemo (see attached) == it is normal
work for Buddy-object! 

I think you make mistakes:
1) __init__ for 'view' always get 3-parameters (self, context, request)
2) getData must return dictionary.







configure  
xmlns=http://namespaces.zope.org/browser;
xmlns:zope=http://namespaces.zope.org/zope;
  layer name=centershock/
   
  skin name=centershock layers=centershock rotterdam default/

  form
name=registrationForm.html
 schema=.test.registrationForm
 class=.test.registrationFormView
 permission=zope.Public
 layer=centershock
 for=*/
  
/configurefrom zope.interface import Interface
from zope.schema import TextLine, Password

class registrationForm(Interface):
login = TextLine(title=uUsername)


class registrationFormView:

def getData(self):
return {}
def setData(self):
pass
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 15:18 schrieb Garanin Michael:
 I simulate this for Buddy from buddydemo (see attached) == it is normal
 work for Buddy-object!

 I think you make mistakes:
 1) __init__ for 'view' always get 3-parameters (self, context, request)

I've removed __init__ from the view class, like you did.

 2) getData must return dictionary.

getData was never called (otherwise I would jumped into pdb).

Anyway, I've changed it accordingly and still no success.

Any more ideas?

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Rupert Redington
Florian Lindner wrote:
 Am Freitag, 10. Februar 2006 15:18 schrieb Garanin Michael:
 I simulate this for Buddy from buddydemo (see attached) == it is normal
 work for Buddy-object!

 I think you make mistakes:
 1) __init__ for 'view' always get 3-parameters (self, context, request)
 
 I've removed __init__ from the view class, like you did.
 
 2) getData must return dictionary.
 
 getData was never called (otherwise I would jumped into pdb).
 
 Anyway, I've changed it accordingly and still no success.
 
 Any more ideas?
 
 Florian

I've just run the same test, Michael's code works for me, but _only_
when I declare an interface specifically in the for attribute,

eg:
for=persistent.interfaces.IPersistent

if I use a wildcard I get the 404 Florian describes...

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Rupert Redington
Florian Lindner wrote:

 
 Also specifying an interface and calling the view from an object implementing 
 this interface does not make it work.
 
 FYI - Florian, it appears we're doing something very similar - mines a
 signup/registration form too! Do you intend to submit the form data to a
 method on a localUtility?
 
 Don't know exactly how I will proccess the data... first task is to make the 
 form working... :-(
 
 Florian

Here's what I'm using,
Rupert:

form
  name=Signup.html
  permission=zope.Public
  class=singleton.browser.signup.SignUp
  for=persistent.interfaces.IPersistent
  schema=singleton.interfaces.ISingletonSignup
  /

class ISingletonSignup(Interface):
A minimal schema for use in a sign-up process.

Gathers a username and full name and email.


login = TextLine(title=uLogin,
 description=uLogin/Username.,
 required=True)

title = TextLine(title=u'Full Name',
 description=uYour real name,
 required=True)

email = TextLine(title=u'Email',
 description=u'The email address to which your
password will be sent.',
 required=True)


class SignUp:

def getData(self):
return {}

def setData(self):
pass
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
В Птн, 10/02/2006 в 17:18 +0300, Garanin Michael пишет:
 I simulate this for Buddy from buddydemo (see attached) == it is normal
 work for Buddy-object! 
for work my example don't forget insert

   implements 
   interface=.test.registrationForm /

to content class=.buddy.Buddy - tag. 


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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
I think 'browser:form' will be 'deprecated'. 
Try use 'zope.formlib' for new automatic-generated forms. It's easy and
more undestandable and more flexibility.

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael

В Птн, 10/02/2006 в 17:47 +0100, Florian Lindner пишет:
 Am Freitag, 10. Februar 2006 15:55 schrieb Garanin Michael:
  I think 'browser:form' will be 'deprecated'.
  Try use 'zope.formlib' for new automatic-generated forms. It's easy and
  more undestandable and more flexibility.
 
 Hi,
 You have any proof that the browser:form will be deprecated?
 

This links:
http://www.z3lab.org/sections/blogs/philipp-weitershausen/2005_12_14_zcml-needs-to-do-less
http://www.infrae.com/presentations/present_PF_DocumentLibrary/schemas
http://faassen.n--tree.net/blog/view/weblog/2005/09/06/0



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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Garanin Michael
 I've played with zope.formlib before that. I didn't manage to generate a 
 entire form, just the input ... statemenets were generated, without any 
 html headers or anything like that. So I need to add them manually with 
 python code or a template. Can you tell me how I can generate a form. 
 Basically the same like the form directive we're talking about all the time.
 
 
 Thanks,
 
 Florian
It's easy. Example:

1) class IMyForm(Interface):
title = TextLine(...)

2) class MyAddForm(zope.formlib.AddForm):
form_fields = IMyForm

def create(self, data):
   # create you object from data-dictionary


   class MyEditForm(zope.formlib.EditForm):
form_fields = IMyForm
# yes it's all ! ;-)

3) in browser.zcml
   
  page
  name=AddMyObject.html
  for=zope.app.container.interfaces.IAdding 
  class=.MyAddForm
  permission=zope.ManageContent
  /
  page
  name=edit.html
  for=.IMyObjectInterface
  class=.MyEditForm
  permission=zope.ManageContent
  /

P.S. you can see usage zope.formlib in 'zsqlmap' (my product, see
zope.org ;-)









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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Freitag, 10. Februar 2006 20:10 schrieb Garanin Michael:
  I've played with zope.formlib before that. I didn't manage to generate a
  entire form, just the input ... statemenets were generated, without any
  html headers or anything like that. So I need to add them manually with
  python code or a template. Can you tell me how I can generate a form.
  Basically the same like the form directive we're talking about all the
  time.
 
 
  Thanks,
 
  Florian

 It's easy. Example:

 1) class IMyForm(Interface):
 title = TextLine(...)

 2) class MyAddForm(zope.formlib.AddForm):
   form_fields = IMyForm

   def create(self, data):
  # create you object from data-dictionary


class MyEditForm(zope.formlib.EditForm):
   form_fields = IMyForm
 # yes it's all ! ;-)

 3) in browser.zcml

   page
   name=AddMyObject.html
   for=zope.app.container.interfaces.IAdding
   class=.MyAddForm
   permission=zope.ManageContent
   /
   page
   name=edit.html
   for=.IMyObjectInterface
   class=.MyEditForm
   permission=zope.ManageContent
   /

 P.S. you can see usage zope.formlib in 'zsqlmap' (my product, see
 zope.org ;-)

Thanks for your example. But I've the same error, a 404.

in views.py:

from zope.formlib.form import EditForm
from interfaces import IRegistrationForm

class registrationForm(EditForm):
form_fields = IRegistrationForm


in configure.zcml:

page
name=registrationForm.html
class=.views.registrationForm
permission=zope.Public
layer=centershock
for=CS.centershock.interfaces.ICentershock /


And I try to call it with:

/++skin++centershock/cs/registerForm.html whereas cs is a ICentershock object.

It still gives a 404.

Any guess what's wrong?

Thanks,

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Stephan Richter
On Thursday 09 February 2006 13:27, Florian Lindner wrote:
 Why that? Anybody knows?

Any resolution? (I did not have time to read the entire thread carefully.)

If not, this does seem like a bug.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Alen Stanisic
On Fri, 2006-02-10 at 22:18 +0100, Florian Lindner wrote:
 Thanks for your example. But I've the same error, a 404.
 
 in views.py:
 
 from zope.formlib.form import EditForm
 from interfaces import IRegistrationForm
 
 class registrationForm(EditForm):
 form_fields = IRegistrationForm
 
 
 in configure.zcml:
 
 page
 name=registrationForm.html
 class=.views.registrationForm
 permission=zope.Public
 layer=centershock
 for=CS.centershock.interfaces.ICentershock /
 
 
 And I try to call it with:
 
 /++skin++centershock/cs/registerForm.html whereas cs is a ICentershock object.
 
 It still gives a 404.
 
 Any guess what's wrong?
 

What happens if you changed your view.py to:

from zope.formlib.form import Form
.
.
class registrationForm(Form):
.
.

Alen


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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Florian Lindner
Am Samstag, 11. Februar 2006 00:29 schrieb Alen Stanisic:
 On Fri, 2006-02-10 at 22:18 +0100, Florian Lindner wrote:
  Thanks for your example. But I've the same error, a 404.
 
  in views.py:
 
  from zope.formlib.form import EditForm
  from interfaces import IRegistrationForm
 
  class registrationForm(EditForm):
  form_fields = IRegistrationForm
 
 
  in configure.zcml:
 
  page
  name=registrationForm.html
  class=.views.registrationForm
  permission=zope.Public
  layer=centershock
  for=CS.centershock.interfaces.ICentershock /
 
 
  And I try to call it with:
 
  /++skin++centershock/cs/registerForm.html whereas cs is a ICentershock
  object.
 
  It still gives a 404.
 
  Any guess what's wrong?

 What happens if you changed your view.py to:

 from zope.formlib.form import Form
 .
 .
 class registrationForm(Form):

I get a system error:

2006-02-11T00:41:25 ERROR SiteError 
http://horus:8080/++skin++centershock/cs/registrationForm.html
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in 
publish
result = publication.callObject(request, object)
  File /home/florian/Zope3/src/zope/app/publication/zopepublication.py, line 
161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in 
mapply
return debug_call(object, args)
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in 
debug_call
return object(*args)
  File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in __call__
self.update()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in update
self.setUpWidgets()
  File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in 
setUpWidgets
adapters=self.adapters, ignore_request=ignore_request
  File /home/florian/Zope3/src/zope/formlib/form.py, line 337, in 
setUpEditWidgets
field = form_field.field
AttributeError: 'str' object has no attribute 'field'
127.0.0.1 - - [11/Feb/2006:00:41:25 +0200] 
GET /++skin++centershock/cs/registrationForm.html HTTP/1.1 500 89 - 
Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.3 (like Gecko)



I get it now with EditForm too (the backtrace above was produced with 
EditForm) I think I had a typo that caused the 404 in my last post, sorry!.

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Alen Stanisic
On Sat, 2006-02-11 at 00:44 +0100, Florian Lindner wrote:
 I get a system error:
 
 2006-02-11T00:41:25 ERROR SiteError 
 http://horus:8080/++skin++centershock/cs/registrationForm.html
 Traceback (most recent call last):
   File /home/florian/Zope3/src/zope/publisher/publish.py, line 138, in 
 publish
 result = publication.callObject(request, object)
   File /home/florian/Zope3/src/zope/app/publication/zopepublication.py, 
 line 
 161, in callObject
 return mapply(ob, request.getPositionalArguments(), request)
   File /home/florian/Zope3/src/zope/publisher/publish.py, line 113, in 
 mapply
 return debug_call(object, args)
   File /home/florian/Zope3/src/zope/publisher/publish.py, line 119, in 
 debug_call
 return object(*args)
   File /home/florian/Zope3/src/zope/formlib/form.py, line 738, in __call__
 self.update()
   File /home/florian/Zope3/src/zope/formlib/form.py, line 707, in update
 self.setUpWidgets()
   File /home/florian/Zope3/src/zope/formlib/form.py, line 770, in 
 setUpWidgets
 adapters=self.adapters, ignore_request=ignore_request
   File /home/florian/Zope3/src/zope/formlib/form.py, line 337, in 
 setUpEditWidgets
 field = form_field.field
 AttributeError: 'str' object has no attribute 'field'
 127.0.0.1 - - [11/Feb/2006:00:41:25 +0200] 
 GET /++skin++centershock/cs/registrationForm.html HTTP/1.1 500 89 - 
 Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.3 (like Gecko)
 
 
 
 I get it now with EditForm too (the backtrace above was produced with 
 EditForm) I think I had a typo that caused the 404 in my last post, sorry!.
 
 Florian

In your view.py is the syntax when you set form_fields valid, I haven't
seen it before:

form_fields = IRegistrationForm

I usually do it by 

(from zope.formlib import form)
form_fields = form.Fields(IRegistrationForm)

Alen

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-10 Thread Lorenzo Gil Sanchez
El vie, 10-02-2006 a las 22:18 +0100, Florian Lindner escribió:
 Am Freitag, 10. Februar 2006 20:10 schrieb Garanin Michael:

 And I try to call it with:
 
 /++skin++centershock/cs/registerForm.html whereas cs is a ICentershock object.
 
 It still gives a 404.
 
 Any guess what's wrong?
 

Stupid question: isn't '@@' a prefix for the views? Like:

/++skin++centershock/cs/@@registerForm.html 

Just a newbie observation...

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


Re: [Zope3-Users] Trying to use browser:form - 404

2006-02-09 Thread Bernd Dorn


On 09.02.2006, at 19:27, Florian Lindner wrote:


Hello,
I try to create a form build from a schema with browser:form:

form
name=registrationForm.html
schema=.interfaces.registrationForm
class=.views.registrationForm
permission=zope.Public
layer=centershock
for=*/



interfaces.registrationForm looks like that:

from zope.interface import Interface
from zope.schema import TextLine, Password
class registrationForm(Interface):
login = TextLine(title=uUsername)


views.registrationForm:

class registrationForm(object):
def __init__(self):
import pdb; pdb.set_trace()
def getData(self):
import pdb; pdb.set_trace()
def setData(self):
import pdb; pdb.set_trace()

but when I try to call the URL:
http://horus:8080/++skin++centershock/registrationForm.html I just  
get 404.


maybe http://horus:8080/++skin++Centershock/registrationForm.html

skin names are CamelCase per convention and layers lowercase





Why that? Anybody knows?

Thanks,

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