Re: [Zope3-Users] no object attributes on IObjectAddedEvent / IObjectCreatedEvent?

2006-11-24 Thread Florian Lindner
Am Freitag, 24. November 2006 16:55 schrieb Dominique Lederer:
 hi

 just tried to retrive some objects attributes (from an object i created
 vie ZMI) on the IObjectCreatedEvent. Got just emty attributes, so i
 tried it with IObjectAddedEvent, but my attributes are still in initial
 state .

 it works with IObjectModifiedEvent, but thats not my use-case.

 is there any other event i have to use to retrieve my attributes after
 an object has been created?

Quotation from a posting from Fred Drake about the same problem:


Are you using browser:addform?  There are four different attributes
that can be used to tailor when attributes of the object are set:
arguments, keyword_arguments, set_before_add, and set_after_add.
Fields that are input but not included in any of these are set after
adding the object to it's container.


Regards,

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


Re: [Zope3-Users] ForbiddenAttribute when adding to a folder

2006-11-24 Thread Dominique Lederer
Darryl Cousins schrieb:
 Hi Tim,
 
 On Sat, 2006-10-21 at 12:18 +0200, Tim TerlegÄrd wrote:
 Is there a way to add content without having @@+ in the URL? For
 instance I'd like the url for adding events to be /addEvent.

 I get security problems when not having @@+ in the URL. I have this view:

   browser:page
   for=zope.app.container.interfaces.IWriteContainer
   name=addEvent
   class=.eventforms.EventAddForm
   permission=zope.ManageContent
   /

 When I hit the submit button in this add form I get an error:
 ForbiddenAttribute: ('add', zope.app.folder.folder.Folder object at
 0xb6e65d2c)
 
 Forbidden here in the sense that Folder does not have an 'add'
 attribute.
 
 I realize IWriteContainer might not be the right interface, it doesn't
 have any add method.

 Should I have for=zope.app.container.interfaces.IAdding instead and
 somehow add an adapter from IFolder to IAdding or how would I do this?

 Tim
 
 As you point out formlib.BaseAddForm calls the add method of the
 context:
 
 _finished_add = False
 
 def add(self, object):
 ob = self.context.add(object)
 self._finished_add = True
 return ob
 
 I (also a novice) always use formlib for adding. But I use my own base
 adding sub-class of BaseAddForm which has this add method:
 
 def add(self, obj):
 try:
 ob = self.container.add(obj)
 except:
 self.container.__setitem__(obj.__name__, obj)
 ob = self.container[obj.__name__]
 self._finished_add = True
 return ob
 
 I almost always use a NameChooser to choose the name for the object. So
 I can trust using __name__ as the dict key.
 
 I use self.container here that usually resolves to self.context but on
 some occassions the context is not the container I want to be adding to.
 
 Hopes this helps.
 
 Darryl

yes, thanks, it helped me

but what are we doing wrong here, that the base methods wont work?

why should my container know about the add method?

any help welcome
thanks
Dom
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] no object attributes on IObjectAddedEvent / IObjectCreatedEvent?

2006-11-24 Thread Dominique Lederer
Florian Lindner schrieb:
 Am Freitag, 24. November 2006 16:55 schrieb Dominique Lederer:
 hi

 just tried to retrive some objects attributes (from an object i created
 vie ZMI) on the IObjectCreatedEvent. Got just emty attributes, so i
 tried it with IObjectAddedEvent, but my attributes are still in initial
 state .

 it works with IObjectModifiedEvent, but thats not my use-case.

 is there any other event i have to use to retrieve my attributes after
 an object has been created?
 
 Quotation from a posting from Fred Drake about the same problem:
 
 Are you using browser:addform?  There are four different attributes
 that can be used to tailor when attributes of the object are set:
 arguments, keyword_arguments, set_before_add, and set_after_add.
 Fields that are input but not included in any of these are set after
 adding the object to it's container.
 
 
 Regards,
 
 Florian
 

thank you both, that helped :)

regards Dom

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


[Zope3-Users] custom widgets (IDisplayWidget)

2006-11-24 Thread Hassan Alirezaei

Hello guys,

I have a custom widget and I cannot manage to have a custom way of 
displaying it after editing.
as far as I know, I should be registering the view for  
form.interfaces.IDisplayWidget(for display) and 
form.interfaces.IInputWidget(for editing).

I use the following zcml lines:

  zope:view type=zope.publisher.interfaces.browser.IBrowserRequest
  provides=zope.app.form.interfaces.IInputWidget
  for=..interfaces.II18N
  factory=.widgets.SimpleI18NInputWidget
  permission=zope.Public /


  zope:view type=zope.publisher.interfaces.browser.IBrowserRequest
  provides=zope.app.form.interfaces.IDisplayWidget
  for=..interfaces.II18N
  factory=.widgets.I18NSimpleDisplayWidget
  permission=zope.Public  /

not the first statement is applied and I can get my custom-rendered 
widget at the time of editing or adding an object. but the display of 
the schema is not changed at all by the second zcml code.


later, I notices that in zope.app.schema package, there are some default 
Display classes for zope3 default widgets like URI that apparently set 
the tell zope to display a URI widget inside  a/a tags but It when I 
try URI it does not appear like that (it is treated exactly like 
textline widget...


I am quite confused here... any thing I am missing???
Thanks a lot for any help
Hass
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] custom widgets (IDisplayWidget)

2006-11-24 Thread Kapil Thangavelu
part of it depends not only registration of the custom display widget, but  
also how your rendering the display, ie. if your using formlib, just using  
a displayformbase should do it, if your using zope.app.form directly  
you'll might also need to specify that you want to specify IDisplayWidget  
as the type when rendering, ie. its hard to say without the other piece of  
this, namely how your rendering the form.


-kapil

On Fri, 24 Nov 2006 13:17:24 -0600, Hassan Alirezaei  
[EMAIL PROTECTED] wrote:



Hello guys,

I have a custom widget and I cannot manage to have a custom way of  
displaying it after editing.
as far as I know, I should be registering the view for   
form.interfaces.IDisplayWidget(for display) and  
form.interfaces.IInputWidget(for editing).

I use the following zcml lines:

   zope:view type=zope.publisher.interfaces.browser.IBrowserRequest
   provides=zope.app.form.interfaces.IInputWidget
   for=..interfaces.II18N
   factory=.widgets.SimpleI18NInputWidget
   permission=zope.Public /


   zope:view type=zope.publisher.interfaces.browser.IBrowserRequest
   provides=zope.app.form.interfaces.IDisplayWidget
   for=..interfaces.II18N
   factory=.widgets.I18NSimpleDisplayWidget
   permission=zope.Public  /

not the first statement is applied and I can get my custom-rendered  
widget at the time of editing or adding an object. but the display of  
the schema is not changed at all by the second zcml code.


later, I notices that in zope.app.schema package, there are some default  
Display classes for zope3 default widgets like URI that apparently set  
the tell zope to display a URI widget inside  a/a tags but It when I  
try URI it does not appear like that (it is treated exactly like  
textline widget...


I am quite confused here... any thing I am missing???
Thanks a lot for any help
Hass
___
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


Re: [Zope3-Users] Buildout query

2006-11-24 Thread David Pratt
Hi Kapil. Many thanks for your reply. I will be sure to look at this. 
Examining a few real applications that make use of buildout should 
definitely help make things clearer.


Regards,
David

Kapil Thangavelu wrote:


infrae's documentlibrary looks like a good example of using the buildout 
machinery for a custom application.


-k

On Fri, 24 Nov 2006 13:57:25 -0600, David Pratt [EMAIL PROTECTED] 
wrote:


It is perhaps a bit too early for this discussion. All I can say is 
that it is getting tougher to keep track of packages and dependencies 
when you want to mix and match for different instances with packages 
of different versions coming from private and public repository 
sources. Given that there are packages I want to remove (packages I 
don't use), replace (like a custom zodb so that I don't need to change 
zodb imports all over the place) or add in z3 just adds to the mix. It 
would be great if someone could paint a clear picture of the best way 
to deal with this so the packaging is more transparent and less of a 
distraction for development. Many thanks.


Regards,
David

David Pratt wrote:
I am just beginning to look at buildout. I want to be able to combine 
my z3 packages with some of z3's, also replacing some of z3's 
packages for customized versions of the same package. Is anyone doing 
this or similar yet that they might comment on how useful buildout is 
on anything more complicated. Many thanks.

 Regards,
David

___
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


Re: [Zope3-Users] Buildout query

2006-11-24 Thread David Pratt
Hi there. I downloaded documentlibrary to experiment a bit. Though I got 
a traceback on zc.recipe.egg during the process, it is is clear to me 
the power of buildout - thanks Jim! It also raised a few questions for me:


1. For zope3 recipe, how would one omit certain packages from [zope3] 
part of the buildout
2. How could one omit replace a package with a customized version of 
same stored in a private svn for [data] part
3. How can one pull from private svn repository for the [instance] part 
where you don't have an egg registered with PyPI?


It strikes me that this is great way to package a finished app, and also 
try different things out without concern for your system site-packages. 
But I am of course interested in sandbox scenario just as much or more 
since I am always working with more that a single package at a time that 
are in a changing state always. It definitely looks at though I need to 
improve my egg lingo due to the different ways of describing eggs :-) 
Many thanks.


Regards,
David


David Pratt wrote:
Hi Kapil. Many thanks for your reply. I will be sure to look at this. 
Examining a few real applications that make use of buildout should 
definitely help make things clearer.


Regards,
David

Kapil Thangavelu wrote:


infrae's documentlibrary looks like a good example of using the 
buildout machinery for a custom application.


-k

On Fri, 24 Nov 2006 13:57:25 -0600, David Pratt 
[EMAIL PROTECTED] wrote:


It is perhaps a bit too early for this discussion. All I can say is 
that it is getting tougher to keep track of packages and dependencies 
when you want to mix and match for different instances with packages 
of different versions coming from private and public repository 
sources. Given that there are packages I want to remove (packages I 
don't use), replace (like a custom zodb so that I don't need to 
change zodb imports all over the place) or add in z3 just adds to the 
mix. It would be great if someone could paint a clear picture of the 
best way to deal with this so the packaging is more transparent and 
less of a distraction for development. Many thanks.


Regards,
David

David Pratt wrote:
I am just beginning to look at buildout. I want to be able to 
combine my z3 packages with some of z3's, also replacing some of 
z3's packages for customized versions of the same package. Is anyone 
doing this or similar yet that they might comment on how useful 
buildout is on anything more complicated. Many thanks.

 Regards,
David

___
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


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