Re: Kupu shows up even if the TextField doesn't support text/html
"Martin Aspeli" <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.archetypes.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 02 May 2006 10:33:55 +0100, Duncan Booth <duncan.booth-+q9EdC6cpuuCZ5vHv/[email protected]> wrote: > Yes, I think you are right and I need to tighten up the test for loading > kupu. The problem I'm trying to solve is that a document which has just > been created e.g. ATDocument has a default output type of HTML, but since > the field is empty it claims its current type is 'text/plain'. In that > situation we need kupu to load even though the field isn't currently > html. Sure. But that's a slightly different problem. How about: allowedContentTypes = getattr(field, 'allowed_content_types', []) contentType = field.getContentType(context) if contentType == 'text/html': return True elif len(content) == 0 and 'text/html' in allowedContentTypes: return True # go kupu else: return False > As you point out though, just because you are using RichWidget doesn't > mean > that html is really one of the allowed content types, so I made a wrong > assumption there. I don't think anyone ever considered this use case. There's a bug in AT where the type will be reset to text/plain every other time you save if there's only one content type (I have a fix for it, though, it's a trivial template change) > Likewise the link to force kupu on needs to test the allowed content > types, > which is a pity because right now it just tests for the general case of > kupu being enabled and runnable in that browser. Well again, a small test for 'text/html' in field.allowed_content_types should suffice. Martin -- "You can just adapt yourself out of it..." // Archipelago sprint 26/04/2006 ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642