Hi,
I'm trying to make Poi *optionally* support text/html as an
allowable
type. To that end, I have:
TextField(
name='details',
allowable_content_types=ISSUE_MIME_TYPES,
widget=RichWidget(
label="Details",
description="Please provide further
details",
rows="15",
allow_file_upload=False,
label_msgid='Poi_label_details',
description_msgid='Poi_help_details',
i18n_domain='Poi',
),
required=True,
default_content_type=DEFAULT_ISSUE_MIME_TYPE,
searchable=True,
default_output_type="text/html"
),
(note that this is generated with ArchGenXML), and in
config.py, I define:
ISSUE_MIME_TYPES = ('text/x-web-intelligent',)
DEFAULT_ISSUE_MIME_TYPE = 'text/x-web-intelligent'
The idea is that people can add 'text/html' to that list
if they want to.
After fixing a small AT bug where it would lose the mimetype
if the field
only had a single one and then fall back on text/plain (will
commit it
once I've tested a bit more), I'm left with a rather grim
problem:
In Firefox, kupu loads even when text/html isnt' in the
list of allowable
MIME types! When saved, I get <b>s and <i>s in
my plain-text field. :-(
kupu is a mystery to me, but I'm sure it must be able to
*not* load itself
conditionally, because it does so when it presents the
"edit using kupu"
option when the current mimetype isn't HTML.
If I put this just before the last return statement in
contentUsesKupu.py,
I get closer:
allowedTypes = getattr(field, 'allowable_content_types',
None)
if allowedTypes is not None and len(content) == 0:
if 'text/html' not in allowedTypes:
return False
This stops kupu stomping on my content, but doesn't hide
the "edit using
kupu" link, which could still cause confusion. I'd
consider this a bug in
kupu - but I don't have commit privs and as I said, kupu's
uber-general-ness scares me.
Martin
--
"You can just adapt yourself out of it..." //
Archipelago sprint
26/04/2006d
-------------------------------------------------------
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
_______________________________________________
Archetypes-devel mailing list
Archetypes-devel lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/archet
ypes-devel
|