Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Jim Washington
Frank Burkhardt wrote:
 Hi,

 On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
   
 Hello,
 I've added some content objects of interface IFoo to my site.
 Then I added a catalog to my site (and also a IntID utility). I registered 
 both. To the catalog I've added a FieldIndex and a TextIndex, set the 
 interface to IFoo and the fieldname to a field that IFoo has. I registered 
 both indexes.
 

 The IntID utility has to be registered *before* all the objects you
 want to find. No object created before you had a registered IntID
 will ever be found.

 Have a look at

  http://zope3.mpg.de/suchen (Das Prinzip)

   
You can get the IntIDs utility to register objects after they are created.

Something like the below will register and catalog a bunch of items:

def catalog_items(self):
intids = zapi.getUtility(IIntIds,[name])
catalog = zapi.getUtility(ICatalog,[name])
for item in some_function_that_returns_the_items():
catalog.index_doc(intids.register(item), item)

The most important part is the intids.register(item) statement.

-Jim Washington

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


[Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Jim Washington
:: moved to zope3-users

Jeff Rush wrote:
 Tarek Ziadé wrote:
 Jeff Rush wrote:

 what does your code actually do ?

 Provide a chat window at the bottom of a page, in which a student
 interacts with a teaching app and members of his team.  In the upper
 portion of the page, the teaching app alternately presents proficency
 questionaires and lessons.

 My idea was to construct a Zope widget component that can be dropped
 over, using widget= in ZCML, a TextArea/Lines Zope widget and
 transform it into an async typing window into a chat space.

You might consider using jsonserver (JSON-RPC) for the ajax-y
communication.  Soon, JSON-RPC (1.1-specification) will have native
support for keyword (named) parameters, which provides a python-ish feel
for the javascript calls.

I have a public example (not open-sourced, sorry - line-of-business app)
of jsonserver in action at http://www1.vtdata.org . It's fast and does
the async communication with little fuss.

jsonserver is available at http://zif.hill-street.net/jsonserver

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


Re: [Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Marco Mariani

Jim Washington wrote:From the docs:


jsonserver is available at http://zif.hill-street.net/jsonserver


From the docs:


jsolait from http://jsolait.net is the recommended client-side javascript 
library.
 



I guess I won't have problems with Mochikit instead, but why is it 
recommended ?



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


Re: [Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Benji York

Jim Washington wrote:

I have a public example (not open-sourced, sorry - line-of-business app)
of jsonserver in action at http://www1.vtdata.org . It's fast and does
the async communication with little fuss.


Very cool.
--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Marco Mariani

Jim Washington wrote:


The last time I looked, MochiKit did JSON, but not JSON-RPC.
 


Nor does the latest release. Point taken, tnx.

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


Re: [Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Jim Washington
Benji York wrote:
 Jim Washington wrote:
 I have a public example (not open-sourced, sorry - line-of-business app)
 of jsonserver in action at http://www1.vtdata.org . It's fast and does
 the async communication with little fuss.

 Very cool.
Thanks!  (and apologies to non-US-ians about the US-centric questions :(
) The quiz app still has a few soon-to-be-resolved edge-case buglets,
but we have been using it for high school contests around the state
(yes, through cranky school district firewalls/proxies, etc.), and for
occasional exams around the university.

An upcoming jsonserver release will have its own JSON-RPC javascript
included, based on Roger's JSON-RPC javascript in Tiks.  jsolait, while
still OK to use, will no longer be an external recommended dependency,
which I think will make a lot of people happy.

The new semantics of JSON-RPC1.1 will be available.  Keyword parameters
are cool!

Best of all, the new release will be a unified release that will operate
in both Zope 2/Five and Zope 3.  Balazs Ree is the genius behind that
amazing feat.

Stay tuned!

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


[Zope3-Users] Re: [Zope3-dev] Re: Zope 3 lacks Ajax capability?

2006-05-16 Thread Balazs Ree
On Tue, 16 May 2006 10:19:41 -0400, Jim Washington wrote:
 Best of all, the new release will be a unified release that will operate
 in both Zope 2/Five and Zope 3.  Balazs Ree is the genius behind that
 amazing feat.

Hah. I doubt if these words can ever be deserved. But if yes, they would
go to those few people that can actually understand Zope3 and
Five issues in depth: we all know them, and I'm not one.

On the other hand, the Zope2 / Zope3 integration of jsonserver will result
in some lessons learned, with benefit to all those who want to build
similarly interoperable products. I will sum up on this list.

-- 
Balazs Ree


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


Re: [Zope3-Users] Composing content objects

2006-05-16 Thread Jachin Rupe


On May 16, 2006, at 3:20 AM, Achim Domma wrote:


mats.nordgren wrote:

def __init__(self, schema, **kw):  you need to pass a  
schema as a non

key-word



Thanks! That solved my problem. Now I get a component lookup error,  
but I think this is, because there is no default widget for the  
object. So I have to register one via zcml. Am I right?


maybe you can use zcml... if someone knows how to do that, that would  
be cool.


I'm trying to do something similar.

Here's an example of how to solve the component look up error:

http://www.mail-archive.com/zope3-users@zope.org/msg02953.html

I had to make my own EditView and AddView.  However as you'll see I'm  
running into a 'Could not adapt' error.  So this solution appears to  
need more work, but I think it is progress.


-jachin



regards,
Achim

PS.: Also thanks to Dominik, which pointed me to the same solution.
___
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] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:
 Hi,

 On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
  Hello,
  I've added some content objects of interface IFoo to my site.
  Then I added a catalog to my site (and also a IntID utility). I
  registered both. To the catalog I've added a FieldIndex and a TextIndex,
  set the interface to IFoo and the fieldname to a field that IFoo has. I
  registered both indexes.

 The IntID utility has to be registered *before* all the objects you
 want to find. No object created before you had a registered IntID
 will ever be found.

 Have a look at

  http://zope3.mpg.de/suchen (Das Prinzip)

I've done that and it does not help.

The IntID utility says that 3 objects are registered, but the catalog indexes 
are still zero count.

Thanks.

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 13:23 schrieb Jim Washington:
 Frank Burkhardt wrote:
  Hi,
 
  On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
  Hello,
  I've added some content objects of interface IFoo to my site.
  Then I added a catalog to my site (and also a IntID utility). I
  registered both. To the catalog I've added a FieldIndex and a TextIndex,
  set the interface to IFoo and the fieldname to a field that IFoo has. I
  registered both indexes.
 
  The IntID utility has to be registered *before* all the objects you
  want to find. No object created before you had a registered IntID
  will ever be found.
 
  Have a look at
 
   http://zope3.mpg.de/suchen (Das Prinzip)

 You can get the IntIDs utility to register objects after they are created.

 Something like the below will register and catalog a bunch of items:

 def catalog_items(self):
 intids = zapi.getUtility(IIntIds,[name])
 catalog = zapi.getUtility(ICatalog,[name])
 for item in some_function_that_returns_the_items():
 catalog.index_doc(intids.register(item), item)

 The most important part is the intids.register(item) statement.

The problem is not that objects have been created before the IntIDs utility.

The IntID utility says that 3 objects are registered, but the catalog indexes 
are still zero count.

Thanks,

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Jim Washington

 The problem is not that objects have been created before the IntIDs utility.

 The IntID utility says that 3 objects are registered, but the catalog indexes 
 are still zero count.

   
This is a bit baffling.  Did you name your IntIDs utility?  The IntIDs
utility works best when unnamed, I think.

-Jim Washington


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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Frank Burkhardt
Hi,

On Tue, May 16, 2006 at 07:08:34PM +0200, Florian Lindner wrote:
 Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:

[snip]

  The IntID utility has to be registered *before* all the objects you
  want to find. No object created before you had a registered IntID
  will ever be found.
 
  Have a look at
 
   http://zope3.mpg.de/suchen (Das Prinzip)
 
 I've done that and it does not help.

Are you sure, your object implements the interface, you're indexing? Use the
introspector to find out.

Regards,

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 21:51 schrieb Frank Burkhardt:
 Hi,

 On Tue, May 16, 2006 at 07:08:34PM +0200, Florian Lindner wrote:
  Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:

 [snip]

   The IntID utility has to be registered *before* all the objects you
   want to find. No object created before you had a registered IntID
   will ever be found.
  
   Have a look at
  
http://zope3.mpg.de/suchen (Das Prinzip)
 
  I've done that and it does not help.

 Are you sure, your object implements the interface, you're indexing? Use
 the introspector to find out.

Direkt bereitgestellte Schnittstellen
Keine Schnittstelle direkt bereitgestellt

Bereitgestellte Schnittstellen
xgm.interfaces.IAbbreviation ---
zope.annotation.interfaces.IAttributeAnnotatable 
zope.app.container.interfaces.IContained

I've marked the interface that I've configured the indexes on.

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


[Zope3-Users] ForbiddenAttribute

2006-05-16 Thread Jachin Rupe

hi there

I keep running into problems with my Address Book example.  This one  
should be simple but I can't find the problem.  I may have spent too  
much time looking at it.  I get this error after I add an entry and  
then try to edit it:


--
2006-05-16T17:09:39 ERROR SiteError http://localhost:8080/Jachin% 
20Rupe/@@edit.html

Traceback (most recent call last):
  File /usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py,  
line 138, in publish

result = publication.callObject(request, object)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/publication/ 
zopepublication.py, line 161, in callObject

return mapply(ob, request.getPositionalArguments(), request)
  File /usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py,  
line 113, in mapply

return debug_call(object, args)
  File /usr/local/Zope-3.2.1/lib/python/zope/publisher/publish.py,  
line 119, in debug_call

return object(*args)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/pagetemplate/ 
simpleviewclass.py, line 44, in __call__

return self.index(*args, **kw)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/pagetemplate/ 
viewpagetemplatefile.py, line 83, in __call__

return self.im_func(im_self, *args, **kw)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/pagetemplate/ 
viewpagetemplatefile.py, line 51, in __call__

sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File /usr/local/Zope-3.2.1/lib/python/zope/pagetemplate/ 
pagetemplate.py, line 117, in pt_render

strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File /usr/local/Zope-3.2.1/lib/python/zope/tal/ 
talinterpreter.py, line 277, in __call__

self.interpret(self.program)
  File /usr/local/Zope-3.2.1/lib/python/zope/tal/ 
talinterpreter.py, line 352, in interpret

handlers[opcode](self, args)
  File /usr/local/Zope-3.2.1/lib/python/zope/tal/ 
talinterpreter.py, line 871, in do_condition

if not self.tal or self.engine.evaluateBoolean(condition):
  File /usr/local/Zope-3.2.1/lib/python/zope/tales/tales.py, line  
701, in evaluateBoolean

return not not self.evaluate(expr)
  File /usr/local/Zope-3.2.1/lib/python/zope/tales/tales.py, line  
696, in evaluate

return expression(self)
  File /usr/local/Zope-3.2.1/lib/python/zope/tales/expressions.py,  
line 205, in __call__

return self._eval(econtext)
  File /usr/local/Zope-3.2.1/lib/python/zope/tales/expressions.py,  
line 199, in _eval

return ob()
  File /usr/local/Zope-3.2.1/lib/python/zope/app/form/browser/ 
editview.py, line 98, in update

target=content, names=self.fieldNames)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/form/utility.py,  
line 303, in applyWidgetsChanges

changed = widget.applyChanges(target) or changed
  File /usr/local/Zope-3.2.1/lib/python/zope/app/form/browser/ 
objectwidget.py, line 162, in applyChanges

names=self.names)
  File /usr/local/Zope-3.2.1/lib/python/zope/app/form/utility.py,  
line 303, in applyWidgetsChanges

changed = widget.applyChanges(target) or changed
  File /usr/local/Zope-3.2.1/lib/python/zope/app/form/__init__.py,  
line 86, in applyChanges

field.set(content, value)
  File /usr/local/Zope-3.2.1/lib/python/zope/schema/ 
_bootstrapfields.py, line 183, in set

setattr(object, self.__name__, value)
ForbiddenAttribute: ('street', simple_abook.entry.ABookEntry  
instance at 0x3afa828)


-

No data seems to get saved in the street field when I use the addform  
either.


I'll put the code I'm working with at the bottom.

I have been trying to get a good understanding of ObjectWidget and  
have been have a really hard time.  I got most of the code layout for  
this from here:  http://www.mail-archive.com/zope3-users@zope.org/ 
msg00917.html


I'm using Zope 3.2.1

It seems like since it's a security problem I should be able to fix  
it by changing something in configuration.zcml but I just can not see  
anything I'm missing.  Any help would be appreciated.


thanks.

-jachin

--
configure.zcml
--

configure
xmlns=http://namespaces.zope.org/zope;
xmlns:browser=http://namespaces.zope.org/browser;

content class=.entry.StreetAddress
require
permission=zope.View
interface=.interfaces.IStreetAddress
/
require
permission=zope.ManageContent
set_schema=.interfaces.IStreetAddress
/
/content

content class=.entry.ABookEntry
require
permission=zope.View
interface=.interfaces.IABookEntry
/
require
permission=zope.ManageContent
set_schema=.interfaces.IABookEntry
/
/content

browser:editform

RE: [Zope3-Users] ForbiddenAttribute

2006-05-16 Thread dev
Hi Jachim

[...]
 ForbiddenAttribute: ('street', simple_abook.entry.ABookEntry 
 instance at 0x3afa828)
[...]
 
 class ABookEntryEditView(EditView):
  __used_for__ = IABookEntry
 
  streetAddress_widget = CustomWidgetFactory(ObjectWidget,
 ABookEntry)

Try to use a formlib form with a correct setup.
Or check this part:

  streetAddress_widget = CustomWidgetFactory(ObjectWidget,
 ABookEntry)

The error above tells you that you try to access the 
street attribute on the ABookEntry instance. But your
interfaces describes that the IStreetAddress implementation which is
stored under the streetAddress provides this attribute.
So I guess there is a problem with the custom widget factory setup.
The rest so far seems Ok to me.

Regards
Roger Ineichen

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


[Zope3-Users] How to distribute distinct components among multiple Zope servers?

2006-05-16 Thread Reinhold Strobl
Hi,

I have got a general question: I want my web application to run over multiple
servers. 

For instance, server A provides the views and server B provides business
functionality via utilities. As a side effect, this should help to increase
scalability, since I split functionality over multiple servers.

But how to I get them to work together? Is XML-RPC the right/only solution?

Thanks a lot in advance for your replies,

Reinhold

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