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