Issue23

Title Deliverance: attribute update rules
Priority feature Status chatting
Superseder Nosy List wichert
Assigned To Topics

Created on 2008-02-13.09:43:02 by wichert, last changed 2008-02-14.10:44:46 by paul.

Messages
msg53 (view) Author: paul Date: 2008-02-14.10:44:46
Tres and I talked yesterday about the conditional templating part.  I  
don't think even *that* is immediately obvious, much less merging of  
class values, much less attribute removal.

We think we need a way to play with some of the ideas, without  
throwing the locked-down nature of the declarative side at it.  I  
think Tres and I will explore the idea of a middleware step just  
before/after Deliverance, where you do some things in Python.  Or  
perhaps within Deliverance, so we don't have to re-parse the HTML  
string into a tree.

--Paul

On Feb 14, 2008, at 10:11 AM, Wichert Akkerman wrote:

> Normally replacing the attribute is best. But I do want the ability  
> to merge CSS
> classes, so an option that merges words lists would be useful (ie  
> turn "one two"
> and "two three" into "one two three").
>
> I don't think it is useful to support merging of style attributes.  
> Anyone using
> those instead of proper CSS deserves the pain.
>
> I'm wondering if it would be useful to support removal of  
> attributes. I can see
> a use for doing things like removing js events (ie remove onchange  
> from an input
> element) but I don't think
> that is a high priority. This may already be possible with the  
> existing drop rule.
>
> __________________________________
> Repoze Bugs <bugs@bugs.repoze.org>
> <http://bugs.repoze.org/issue23>
> __________________________________
> _______________________________________________
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
msg52 (view) Author: wichert Date: 2008-02-14.10:11:53
Normally replacing the attribute is best. But I do want the ability to merge CSS
classes, so an option that merges words lists would be useful (ie turn "one two"
and "two three" into "one two three").

I don't think it is useful to support merging of style attributes. Anyone using
those instead of proper CSS deserves the pain.

I'm wondering if it would be useful to support removal of attributes. I can see
a use for doing things like removing js events (ie remove onchange from an input
element) but I don't think
that is a high priority. This may already be possible with the existing drop rule.
msg51 (view) Author: paul Date: 2008-02-14.09:44:00
On Feb 13, 2008, at 11:51 AM, Ian Bicking wrote:

> Paul Everitt wrote:
>> Have you confirmed that this doesn't work?  Meaning, if you write  
>> an  XPath expression that selects attributes, they don't get copied?
>
> Last I checked this (and this still seems to be true in lxml 2) you  
> can't very usefully select attributes; you just get a list of the  
> attribute values back.  So if you did something like:
>
> <copy content="//div[@id='content']/@class" theme="/html/body" />

I tried my XPath foo yesterday and found I could get a list of  
attributes, but was getting the values of the attributes, not the  
nodes.  While I could probably find some heinous XPath expression, it  
makes me wonder about the nature of the problem.

> There'd be no way to tell what attribute you were trying to copy  
> over when the expression is evaluated.
>
> I think to do this there'd have to be some modifier on the  
> expression, to indicate that you want to take the attributes off the  
> selected element.  And maybe you don't want to copy attributes, but  
> rather merge classes?

This is my big question for Wiggy.  If you want the attributes from  
the content, you can just copy over the div.  Do you really need to  
merge the attributes from two nodes into just one node in the theme?

--Paul
msg50 (view) Author: wichert Date: 2008-02-13.09:50:47
Chris asked me to report it here last week. Occasionally I do listen to others,
so I did.

I think I did try that, but I'm not 100% sure.
msg49 (view) Author: paul Date: 2008-02-13.09:46:31
I'd say this is a Deliverance bug more than Repoze, but I don't mind  
tracking it here.

Have you confirmed that this doesn't work?  Meaning, if you write an  
XPath expression that selects attributes, they don't get copied?

--Paul

On Feb 13, 2008, at 9:43 AM, Wichert Akkerman wrote:

>
> New submission from Wichert Akkerman <wichert@wiggy.net>:
>
> It would be very useful if deliverance rules can specify changes to  
> attributes.
> In particular the ability to copy classes from content to the theme  
> can be
> essential.
>
> ----------
> messages: 47
> nosy: wichert
> priority: feature
> status: unread
> title: Deliverance: attribute update rules
>
> __________________________________
> Repoze Bugs <bugs@bugs.repoze.org>
> <http://bugs.repoze.org/issue23>
> __________________________________
> _______________________________________________
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
msg47 (view) Author: wichert Date: 2008-02-13.09:43:02
It would be very useful if deliverance rules can specify changes to attributes.
In particular the ability to copy classes from content to the theme can be
essential.
History
Date User Action Args
2008-02-14 10:44:46 paul set messages: + msg53
2008-02-14 10:11:53 wichert set messages: + msg52
2008-02-14 09:44:01 paul set messages: + msg51
2008-02-13 09:50:47 wichert set messages: + msg50
2008-02-13 09:46:31 paul set status: unread -> chatting
messages: + msg49
2008-02-13 09:43:02 wichert create