Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

CMF 2.2.0-alpha: getIcon

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


y.2009 at wcm-solutions

Nov 16, 2009, 9:24 AM

Post #1 of 7 (1263 views)
Permalink
CMF 2.2.0-alpha: getIcon

Hi!


CMF 2.2.0-alpha has some getIcon changes based on what I proposed here:
https://mail.zope.org/pipermail/zope-cmf/2009-January/028059.html

Unfortunately the issue is more complicated than I thought and some
things are now broken in CMF 2.2.0-alpha: The return values of getIcon()
and icon() are not backwards compatible, breaking e.g. the ZMI icons if
REQUEST['BASEPATH1'] exists.


There are 4 ways to specify icons:


1.) absolute URL:
-----------------

"http://www.example.org/zope_instance/cmf_instance/icons/foo.png"

CMF 2.1: -
CMF 2.2.0-alpha: getIcon(), icon()


2.) URL relative to REQUEST['BASEPATH1']:
-----------------------------------------

"cmf_instance/icons/foo.png"

CMF 2.1: getIcon(), icon()
CMF 2.2.0-alpha: -


3.) URL relative to portal:
---------------------------

"icons/foo.png"

CMF 2.1: getIcon(relative_to_portal=1), icon(1)
CMF 2.2.0-alpha: -


4.) icon id:
------------

"foo.png"

CMF 2.1: -
CMF 2.2.0-alpha: getIcon(relative_to_portal=1), icon(1)


Proposal
--------

In CMF we always need the absolute URL. Since getIcon() and icon()
already have a different meaning and something like
getIcon(absolute=True) looks too complicated for the default, I propose
to add a new method: getIconURL()

getIcon() and icon() should get the same behavior as they had in CMF 2.1.


Any thoughts?

Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


hanno at hannosch

Nov 16, 2009, 10:01 AM

Post #2 of 7 (1221 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Hi.

On Mon, Nov 16, 2009 at 6:24 PM, yuppie <y.2009 [at] wcm-solutions> wrote:
> CMF 2.2.0-alpha has some getIcon changes based on what I proposed here:
> https://mail.zope.org/pipermail/zope-cmf/2009-January/028059.html
>
> Unfortunately the issue is more complicated than I thought and some
> things are now broken in CMF 2.2.0-alpha: The return values of getIcon()
> and icon() are not backwards compatible, breaking e.g. the ZMI icons if
> REQUEST['BASEPATH1'] exists.
>
> There are 4 ways to specify icons:

Oh dear :-(

> Proposal
> --------
>
> In CMF we always need the absolute URL. Since getIcon() and icon()
> already have a different meaning and something like
> getIcon(absolute=True) looks too complicated for the default, I propose
> to add a new method: getIconURL()
>
> getIcon() and icon() should get the same behavior as they had in CMF 2.1.

Sounds reasonable. I was hoping we could get away with a new method
but it seems I failed.

Hanno
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 17, 2009, 5:02 AM

Post #3 of 7 (1209 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Am 16.11.2009, 18:24 Uhr, schrieb yuppie <y.2009 [at] wcm-solutions>:

> In CMF we always need the absolute URL. Since getIcon() and icon()
> already have a different meaning and something like
> getIcon(absolute=True) looks too complicated for the default, I propose
> to add a new method: getIconURL()

> getIcon() and icon() should get the same behavior as they had in CMF 2.1.

> Any thoughts?

getIconURL() would work for me. I'm not sure if I understand your e-mail
correctly but we shouldn't be keeping four different ways of accessing the
icon. Are any of them to be marked as to be deprecated?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2009 at wcm-solutions

Nov 17, 2009, 5:41 AM

Post #4 of 7 (1212 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Hi!


Charlie Clark wrote:
> Am 16.11.2009, 18:24 Uhr, schrieb yuppie <y.2009 [at] wcm-solutions>:
>
>> In CMF we always need the absolute URL. Since getIcon() and icon()
>> already have a different meaning and something like
>> getIcon(absolute=True) looks too complicated for the default, I propose
>> to add a new method: getIconURL()
>
>> getIcon() and icon() should get the same behavior as they had in CMF 2.1.
>
>> Any thoughts?
>
> getIconURL() would work for me. I'm not sure if I understand your e-mail
> correctly but we shouldn't be keeping four different ways of accessing the
> icon. Are any of them to be marked as to be deprecated?

AFAICS we need 2 of them in DynamicType:

icon() is part of OFS.interfaces.IItem and should return the URL
relative to BASEPATH1. This is required to show the icons correctly in
the ZMI.

getIconURL() should become part of IDynamicType and return the absolute
URL. This is the only version we need in CMF.

getIcon() is an alias of icon() and could become deprecated. I don't
know if it's worth the effort to mark the 'relative_to_portal' argument
of icon() as well as deprecated.

I already started implementing these changes.


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 17, 2009, 5:49 AM

Post #5 of 7 (1212 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Am 17.11.2009, 14:41 Uhr, schrieb yuppie <y.2009 [at] wcm-solutions>:

> AFAICS we need 2 of them in DynamicType:
> icon() is part of OFS.interfaces.IItem and should return the URL
> relative to BASEPATH1. This is required to show the icons correctly in
> the ZMI.

> getIconURL() should become part of IDynamicType and return the absolute
> URL. This is the only version we need in CMF.

Right.

> getIcon() is an alias of icon() and could become deprecated. I don't
> know if it's worth the effort to mark the 'relative_to_portal' argument
> of icon() as well as deprecated.

> I already started implementing these changes.

Okay.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 18, 2009, 1:30 AM

Post #6 of 7 (1213 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Am 17.11.2009, 14:41 Uhr, schrieb yuppie <y.2009 [at] wcm-solutions>:

> getIcon() is an alias of icon() and could become deprecated. I don't
> know if it's worth the effort to mark the 'relative_to_portal' argument
> of icon() as well as deprecated.
> I already started implementing these changes.

Hi Yuppie,

now that I have my first project working on buildout I can see the impact
of your changes! No icons in the ZMI or in folder_contents. But simply
turning the content_type.png into a string:${portal_url}/content_type.png
does the trick!

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2009 at wcm-solutions

Nov 18, 2009, 2:00 AM

Post #7 of 7 (1204 views)
Permalink
Re: CMF 2.2.0-alpha: getIcon [In reply to]

Hi!


Charlie Clark wrote:
> Am 17.11.2009, 14:41 Uhr, schrieb yuppie <y.2009 [at] wcm-solutions>:
>
>> getIcon() is an alias of icon() and could become deprecated. I don't
>> know if it's worth the effort to mark the 'relative_to_portal' argument
>> of icon() as well as deprecated.
>> I already started implementing these changes.
>
> now that I have my first project working on buildout I can see the impact
> of your changes! No icons in the ZMI or in folder_contents. But simply
> turning the content_type.png into a string:${portal_url}/content_type.png
> does the trick!

The content_icon property ('Icon' in the ZMI) is obsolete and should be
empty right now. I still have to work on removing it completely.

The icon_expr property ('Icon (Expression)' in the ZMI) should have the
string:${portal_url}/ prefix.

There is an upgrade step available that moves the icon setting to
icon_expr and adds the prefix.


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] zope
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.