Re: [Zope3-Users] how work around broken egg?

2008-01-27 Thread Stephan Richter
On Friday 25 January 2008, John wrote:
 I easy_installed a broken z3c.form-1.7.2-py2.4.egg into my zopeproject.  
 I'd like to fix it.  It looks possible to use svn to checkout 1.7.0 or
 1.8.0 right into the egg directory.  Will this work or is there some
 setup script to run?  Is there a way to get 1.7.2 via svn (_1)?  Is
 there a better way than using svn?  Any suggestions appreciated.

I deleted the 1.7.2 release altogether, because it contained new features. 
That was really bad, because people would get new APIs but expect a bug fix 
release. If you remove the 1.7.2 release from your egg directory, it will now 
download 1.8.0, which is correct.

 Also, when the eggs are fixed, will another bin/easy_install z3c.form
 be sufficient to get the missing files?  Right now it tells me z3c.form
 1.7.2 is already the active version.  Will I need to remove the egg
 somehow and re-install it to get the complete files?

I believe easy_install has an update option. Yes, it does: -U

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Beginner: Reference to ZPT macros

2008-01-27 Thread Stephan Richter
On Thursday 17 January 2008, Hermann Himmelbauer wrote:
 I personally don't like macros that much, therefore I prefer Stephan
 Richters pagelet/viewlet approach, which you can find in z3c.pagelet.

We need to give credit to Roger here. He came up with pagelets as a response 
for hating macros like you do and not liking a pure viewlet approach either. 
That said, I have to agree, I like the pagelet pattern a lot too and it works 
beautiful for your typical Web application.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Zope on WSGI for Deployment - best to still use proxy behind apache? Good/bad servers?

2008-01-27 Thread Stephan Richter
On Wednesday 23 January 2008, Jeff Shell wrote:
 Is there any preferred server to use or not use? why?

Originally we wanted to drop support for zope.server over twisted, but it 
turned out that zope.server was much more stable.

 And ... mod_wsgi. I don't know much about it, but is it better to run
 through that than to go through mod_proxy?

We played with it a little bit and got it working without any hassle. But we 
did not test performance.

 We had one new customer totally surprise us with their traffic/load
 (mostly solved, for now, due to some aggressive caching) and I'm
 interested in trying to find new setups.

I think the server itself is not really creating the bottleneck. What you 
really want to do, is keep your transaction times in Zope very small, like in 
the 100ms range, because a Zope thread is blocked for that long. If you have 
queries or tasks that take a long time (1sec), then you should  run that in 
a thread/process that does not block the server. A good package to start with 
would be lovely.remotetask -- I hope that we will soon release an extension 
that allows you to scale it better.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] How to store objects with multiple owners in the ZODB

2008-01-27 Thread Stephan Richter
On Tuesday 08 January 2008, Hermann Himmelbauer wrote:
 My question is: How would I store these documents in the ZODB? If I create
 a container object for each user and store the document there, how would
 then other users get a link to their own folder? Moreover, what happens
 if the original owner abandons the document?

You clearly thought about the problem, since you already provided 
solutions. :-) It all depends how you identify an owner. I do this by 
checking whether a user has been granted the Owner role locally.

Okay, so now we know how to retrieve the information. Next, how can we 
efficiently extract a list of all the documents a user owns. The answer is a 
catalog. You can create an index that records the owners of each document. 
(That should be about 5-10 lines of code.) When you provide the list, you 
simply return catalog query results, instead of iterating through all items 
in a folder.

What to do when someone abandons a document depends really on your decision 
where to locate it and how you implement other views.

1. If you have one large container, the solution is simple. You write a 
subscriber that checks whether the changed object still has an owner. If not, 
it is deleted. There is not need for more info tracking.

2. If you store the documents locally, and the removed owner matches the 
location user, I would move the documents either to a global abandoned 
folder or to the user folder of the next user on the list.

Which way you want to go, depends on your other design goals.

 If I have one huge container that holds all documents, how would then list
 users their documents?

Use a catalog query. Seriously; it is efficient.

 The other issue is how to set up permissions on these objects, would I e.g.
 store the owners along with the object (e.g. as an object attribute)?

As I said before, I do this using roles. Because you want to assign special 
permissions for owners anyways. Keeping the information twice, is just a 
senseless bookkeeping exercise. That said I commonly create a property for 
these cases:

@apply
def departmentManagers():
role_id = 'pkg.DepartmentManagerOwner'
def get(self):
prm = IPrincipalRoleManager(self)
return tuple([u for u, p in prm.getPrincipalsForRole(role_id)])
def set(self, value):
prm = IPrincipalRoleManager(self)
for principal_id, perm in prm.getPrincipalsForRole(role_id):
prm.unsetRoleForPrincipal(role_id, principal_id)
for principal_id in value:
prm.assignRoleToPrincipal(role_id, principal_id)
return property(get, set)

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] sqlalchemy and FieldProperty

2008-01-27 Thread Stephan Richter
On Friday 21 December 2007, Darryl Cousins wrote:
 I find that when I map a class to a table I lose the auto-magic
 vaidation provided by FieldProperty when setting attributes.

I bet you that sqlalchemy does some evil class hacking. Actually, I gotta 
check this out. :-) Yeah, from looking at the mapper.py module, I can see 
that really weird things happen there. They overwrite attributes left and 
right. Man, I love persistent! I wish they would have used it as a base for 
their work.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Literal double quoted string within single quoted attribute in ZPT

2008-01-27 Thread Stephan Richter
On Monday 17 December 2007, David Pratt wrote:
 Hi. Is there solution for create a single quoted attribute using
 tal:attributes containing literal double quoted items. I am using a
 python method for generating the string. I understand structure will
 unquote but it does not work with an attribute.

Well, attributes must always be quoted based on the XML spec, right. Otherwise 
TAL could produce invalid XML. What does the spec actually say about this?

 I see there is a new 
 z3c.tal package based on lxml.  Will I have to go as far as customizing
 tal to do this? I realize this may be best on the zpt list but it it
 rarely if ever used these days. Many thanks.

Well, if the XML specification allows for your output, we could consider it 
not working this way a bug. However, it would make the code much more 
complicated, I think (unless we support structure as well in this case).

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] `easy_install z3c.widget` fails

2008-01-27 Thread Stephan Richter
On Saturday 08 December 2007, Kent Tenney wrote:
 It can't find z3c.schema

 Is there a better place to report?

http://svn.zope.org/z3c.schema/

But it has not been released as a package yet. I guess that should be done.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] formlib vs z3c.form

2008-01-27 Thread Stephan Richter
On Thursday 06 December 2007, Adam Summers wrote:
 How hard is it to get grok to play nicely with z3c.form et al? Has
 anyone any examples?

Since nobody has answered this follow-up question, here is a quick one from 
me: It is not harder or easier to integrate than other Zope 3 code. I bet you 
that is probably more of a case of being documented. Since I am not using 
grok, I cannot give you any examples.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] wiki refactoring

2008-01-27 Thread Stephan Richter
On Monday 10 December 2007, Roy Mathew wrote:
 Now that the zope3 wiki has grown from an afterthought, to a
 signifcantly useful body of knowledge, I'd like to make the following
 proposal:

  o split the wiki into smaller bits.
  o rework the introduction slightly.
  o fix the question headers
  o start writing small HOWTOs (like the grok mini-HOWTOs).

 I am happy to help with any and all of the above. What do you think?

I think that the people that recently worked on the Wiki did a fine job. I 
just browsed through it the past two days and the story is nice. There are a 
few things that I would have done differently, but it is not major.,

Since you mentioned in a follow-up E-mail that you meant the FAQ, I had a 
quick look. I have to agree, it is huge. That's great! :-) But that also 
means we have to provide a new approach for presentation. I agree with all 
your points. I think the most important part would be to split the FAQ into 
themed sections, such as UI Development, Organization, Development 
Process, etc.

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] zcml for z3c.form

2008-01-27 Thread Stephan Richter
Hi John,

On Thursday 24 January 2008, John wrote:
 I'm converting from formlib to z3c.form.

Cool! :-)

 What should my configure.zcml look like?

 For formlib it is:

   browser:page
     for=zope.app.container.interfaces.IAdding
     name=.Person
     class=.browser.PersonAddForm
     permission=zope.ManageContent
     /

 I assume the 'for=' value should change, but to what?

Yep, it changes to the container interface:

   browser:page
 for=.interfaces.ILimosvc
 name=.Person
 class=.browser.PersonAddForm
 permission=zope.ManageContent
 /

By not using IAdding, it is hard (as in I have spent 30 mins trying to make it 
work and couldn't) to reuse the default add menu. That said, who still uses 
it? :-) The Zope 3 menu code is dog slow.

Also, note that we do support IAdding for the poor souls that still have or 
want to use it. See 
http://svn.zope.org/z3c.form/trunk/src/z3c/form/adding.txt?rev=78513view=auto

Regards,
Stephan
-- 
Stephan Richter
Web Software Design, Development and Training
Google me. Zope Stephan Richter
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] sqlalchemy and FieldProperty

2008-01-27 Thread Darryl Cousins
On Sun, 2008-01-27 at 13:03 -0500, Stephan Richter wrote:
 On Friday 21 December 2007, Darryl Cousins wrote:
  I find that when I map a class to a table I lose the auto-magic
  vaidation provided by FieldProperty when setting attributes.
 
 I bet you that sqlalchemy does some evil class hacking. Actually, I gotta 
 check this out. :-) Yeah, from looking at the mapper.py module, I can see 
 that really weird things happen there. They overwrite attributes left and 
 right. Man, I love persistent! I wish they would have used it as a base for 
 their work.

Hi Stephan,

Thanks for your comment.

Just yesterday I was looking at a couple of external sqlalchemy
projects: Elixir [1] and sqlalchemy-validations [2]. I only had a brief
look through the code but the way sqlalchemy-validations hooks itself
into Elixir seemed point to a way to hook zope fieldproperty in there.
Maybe. ;-)

[1] http://elixir.ematia.de/trac/
[2] http://code.google.com/p/sqlalchemy-validations/

Regards,
Darryl

 
 Regards,
 Stephan

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