[Framework-Team] Re: [Plone-developers] wicked stuff

whit d.w.morriss at gmail.com
Wed Jul 18 15:33:04 UTC 2007


Martijn Pieters wrote:
> On 7/17/07, whit <d.w.morriss at gmail.com> wrote:
>> Martijn Pieters wrote:
>> >    def chunks(self):
>> >         chunks = super(WickedFilter, self).chunks
>> >         # every 2nd entry is the parens group, so filter out by
>> >         # grabbing every 1st and 3rd
>> >         firsts = itertools.islice(chunks, 0, None, 3)
>> >         thirds = itertools.islice(chunks, 2, None, 3)
>> >         result = []
>> >         # then append every 1st and 3rd to a list
>> >         map(result.extend, itertools.izip(firsts, thirds))
>>
>> any difference between this and:
>>
>> for slice in itertools.izip(firsts, thirds):
>>      result.extend(slice)
>>
>
> Nothing, the code grew a bit and wasn't finished. :) There is a if
> len(chunks) <= 1: return chunks missing there too, for example.
>
>> there may be a simpler juncture for getting the desired effect.
>>
>> the filter is run by a subscriber, and running it twice (once for each
>> desired pattern) would be trivial, rather than pushing additional
>> complexity into the filtering classes.  This would happen for both the
>> findall call that is part of the storing event and the split call that
>> is part of rendering.
>>
>> Plone would use these special subscribers and if folks just wanted
>> either/or behavior, they could disable them and use the old subscribers.
>
> I am not too familiar with the subscribers, but that sounds like a
> fine plan to me.
subscribers handle all the action on render or on store.  iirc, it's 
just a matter of setting the pattern before each run of the filter and 
clearing the memos. 

>
> I am assuming the current UI uses a radio select (format a *or* format
> b). You could change this to a set of checkboxes. Replacing the
> subscriber with one that runs either filter based on those selection
> boxes would get you the same effect, no?
>
iirc, the whole point of this was so limi could have an interface where 
one could turn on or off wiki linking(no other choices).  I assume after 
this is solved, thats' what will happen.

-w

-- 

------ d. whit morriss ------
- senior engineer, opencore -
- http://www.openplans.org  -
- m: 415-710-8975           -

"If you don't know where you are,   
 you don't know anything at all"                                             

Dr. Edgar Spencer, Ph.D., 1995

-------------- next part --------------
A non-text attachment was scrubbed...
Name: whit.vcf
Type: text/x-vcard
Size: 303 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-framework-team/attachments/20070718/70631c16/attachment.vcf>


More information about the Framework-Team mailing list