Re: [Zope3-dev] zc.table and zc.resourcelibrary feedback

2006-03-13 Thread Martijn Faassen

Benji York wrote:
Martijn Faassen wrote: 

[snip]
A second issue seems to me a bug in the javascript. When I use 
StandaloneSortFormatter I can click on the title of a column to sort

to see a sorted view. This works wonderfully well. Unfortunately the
 javascript is a bit simplistic in that it simply adds the
sort_on:list parameter over and over to the URL. This makes for very
long and ugly URLs. Want me to work on a bugfix?



Please.  The current JavaScript is very much the simplest thing that
will possibly work.


I looked into it and have written some new JavaScript, but I realized 
that the sorting behavior currently is apparently dependent on the 
amount of items in the 'sort_on' list in the URL. As far as I can 
understand, getRequestSortOn flips the sorting order for each time a 
particular field is mentioned in the URL. I don't know how exactly this 
works in the case of form-based tables, where this information is, I 
believe, POSTed.


Encoding this information in the amount of times a particular item is 
present in the URL (or post body) seems odd. Was the motivation again 
the simplest thing that will possibly work? To really fix it, the sort 
order itself (forward or reversed) should be encoded in the URL (or 
POST), something like sort_forward=Column or sort_reversed=Column. I 
currently do not understand why this approach wasn't taken in the first 
place...



The third issue is more like a missing feature. I was playing with
the batching support, and I got it to work. Still, I had to write a
bit of batching code myself and to make it fully work, I'd have to
make sure of not showing 'previous' at the beginning of the fist
batch, not showing 'next' at the beginning of the last batch, and the
like.


Yes, when writing zc.table we weren't quite sure how the batching
should/would work and were using it in two independent projects.  Both
eventually grew code that's probably much like you wrote.  It would be
interesting to work on a default batcher.


Maybe I'll get to look into this. I still need to consider how it all 
should work together with sorting. Any hints?


Regards,

Martijn
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] zc.table and zc.resourcelibrary feedback

2006-03-13 Thread Gary Poster


On Mar 13, 2006, at 10:59 AM, Martijn Faassen wrote:
[...]

Thanks for looking into this Martijn.  We have some internal versions  
of a sortable zc.table factory that take a different approach, and  
are not using the client-side part of the zc.table code much at all.   
If you're willing to look at it and consider integrating it into  
zc.table, one of us will send you the files privately.  You up for that?


BTW, I think I listed in the release announcement that both of these  
packages could use some TLC.  Thank you generally for considering  
giving them some!


I would love to see resourcelibrary developed in these directions, fwiw:

- pluggable insertion, to address one of the concerns in your  
original message.  I don't remember exactly what Benji and I talked  
about.  Maybe the resources would not be snippets but callable  
transformations.  Maybe we could provide a factory for one kind of  
transformation which could be combined to effectively get the same  
behavior as our current transformation?  A piece of code could  
request a transformation, which might depend on other  
transformations?  Maybe this is too general.


- order-aware dependency insertion: IIRC, the algorithm for gathering  
the necessary dependencies doesn't honor order, which may be a  
problem in some cases.  order-aware could get fragile, though--for  
instance, if one resource says it depends on A and then B, and  
another says it wants B then A, what to do?  Maybe it's necessary to  
have one spelling for order-unaware dependencies, and another for  
order-aware dependencies; maybe that itself is insufficient...


- lighter-weight insertion into the publishing framework.  No one  
(including myself) has followed up materially on Jim's old discussion  
of in-Zope publication pipelines.  The request approach is heavy, and  
maybe a WSGI pipeline element is too heavy also.  It would be nice to  
resolve this, though: replacing the request factory is a bit crazy.


It's not a priority for us to work on these things right now, but we  
open-sourced some of the less-polished packages in hopes that others  
would see their possibilities, as you did, and be intrigued. ;-)


Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] zc.table and zc.resourcelibrary feedback

2006-03-10 Thread Benji York

Martijn Faassen wrote:

The first issue is I think just something that tripped me up and
might be fixed if we put big warning signs in the documentation.


I'll look at making this more noticeable and explaining the reasons.

A second issue seems to me a bug in the javascript. When I use 
StandaloneSortFormatter I can click on the title of a column to sort

to see a sorted view. This works wonderfully well. Unfortunately the
 javascript is a bit simplistic in that it simply adds the
sort_on:list parameter over and over to the URL. This makes for very
long and ugly URLs. Want me to work on a bugfix?


Please.  The current JavaScript is very much the simplest thing that
will possibly work.


The third issue is more like a missing feature. I was playing with
the batching support, and I got it to work. Still, I had to write a
bit of batching code myself and to make it fully work, I'd have to
make sure of not showing 'previous' at the beginning of the fist
batch, not showing 'next' at the beginning of the last batch, and the
like.


Yes, when writing zc.table we weren't quite sure how the batching
should/would work and were using it in two independent projects.  Both
eventually grew code that's probably much like you wrote.  It would be
interesting to work on a default batcher.


Then finally a bit about zc.resourcelibrary that would've tripped me
up if I hadn't looked its source yesterday. zc.resourcelibrary adds 
resources to the head section of the web page by hooking in and

adding it before the /head tag in the output. This doesn't work if
you have a test page that doesn't contain a head section at all. :)


True. :)  Gary and I came come up with a system to add pluggable 
substitutions on a per-resourcelibrary basis, but haven't had the 
time/need to implement it.  I hope Gary remembers the details and 
replies. :)

--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] zc.table and zc.resourcelibrary feedback

2006-03-10 Thread Martijn Faassen

Hi there,

I've just been playing a bit with zc.table. This is very exciting code 
that could make a lot of custom code go away. Way cool!
(and zc.resourcelibrary is also nice!). If I knew the individual 
developers I could give them my personal thanks. :)


I ran into some issues and I figured I would give some feedback:

The first issue is I think just something that tripped me up and might 
be fixed if we put big warning signs in the documentation. Right now it 
says about GetterColumn:


It includes a reasonable simple implementation of ISortableColumn but 
does not declare the interface itself.  It tries to sort on the basis of 
the getter value and can be customized simply by overriding the 
`getSortKey` method.


but it's easy to read over this, and I only found out that GetterColumn 
uses implementsOnly and thus I need to actually do a directlyProvides to 
make it an ISortableColumn after some grasping about. I think I 
understand the motivation - we do not want to make everything sortable 
by default even when we're used GetterColumn, but perhaps this could be 
spelled out a bit more explicitly.


A second issue seems to me a bug in the javascript. When I use 
StandaloneSortFormatter I can click on the title of a column to sort to 
see a sorted view. This works wonderfully well. Unfortunately the 
javascript is a bit simplistic in that it simply adds the sort_on:list 
parameter over and over to the URL. This makes for very long and ugly 
URLs. Want me to work on a bugfix?


The third issue is more like a missing feature. I was playing with the 
batching support, and I got it to work. Still, I had to write a bit of 
batching code myself and to make it fully work, I'd have to make sure of 
not showing 'previous' at the beginning of the fist batch, not showing 
'next' at the beginning of the last batch, and the like.


In addition, when combining batching with sorting support it is rather 
confusing - when you reverse sort everything, the batching links will 
need to work differently too. Batching link support would be nice there.


I may find myself working on that too; if people have thoughs about it 
let me know.


Then finally a bit about zc.resourcelibrary that would've tripped me up 
if I hadn't looked its source yesterday. zc.resourcelibrary adds 
resources to the head section of the web page by hooking in and adding 
it before the /head tag in the output. This doesn't work if you have a 
test page that doesn't contain a head section at all. :)


Regards,

Martijn
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com