#70 — LinguaPlone doesn't allow manual editing of IDs

State Resolved
Version:
Area Functionality
Issue type Bug
Severity Medium
Submitted by Alex Limi
Submitted on Nov 04, 2006
Responsible Dorneles Tremea
Target release:


Somebody reported an issue in the main Plone issue tracker that I suspect is a LinguaPlone bug:

http://dev.plone.org/plone/ticket/5876

Quote:

"""
If a page is translated and custom short names (= ZMI Object ids) are enabled, the short name field is ignored and the title is instead used for a short name.

When translating a page, Plone suggests a short name in the format "original_shortname" + "-" + "ISO-LanguageCode", (e.g. myname-de). However, this field is ignored when submitting the translation. Instead, the title is used with whitespace substituted by dashes.

One workaround is to edit the translation after it is submitted and change the shortname here, then it is saved.

"""
Added by (anonymous) on Nov 20, 2006 05:17 PM
I have the same issue with latest Linguaplone 0.9. I must rename shortnames after creation of translation. It look like cool feature of plone "creation of shortname based on Title" overrides the Linguaplone shortname.
Added by Tom "Spanky" Kapanka on Jul 05, 2007 06:07 PM
I have also confirmed this bug. Of significant note is that you don't even need to install LinguaPlone for this bug to manifest. Simply having LinguaPlone on the filesystem in the Products folder causes it as well. Hope this helps squash this bug.
Added by Lennart Regebro on Aug 02, 2007 07:09 PM
LinguaPlones processForm methods calleds _renameAfterCreation without parameters, while Archetypes passes check_auto_id=True.

The only problem here is that LinguaPlones auto-ids bear no resemblance to Archetypes auto_ids, so it will always return that the object should be renamed. The fix is simple, but ugly, si I'm not gonna check it in before further discussion. It's simply to check if an id was set in the form or not. If it was, then we check if it should be renamed or not.

Here is an SVN-diff (made on the 1.0 branch).

Index: I18NBaseObject.py
===================================================================
--- I18NBaseObject.py (revision 16282)
+++ I18NBaseObject.py (working copy)
@@ -322,7 +322,8 @@
                 self.invalidateTranslations()
 
         if self._at_rename_after_creation and is_new_object:
- new_id = self._renameAfterCreation()
+ new_id = self._renameAfterCreation(
+ check_auto_id=not not self.REQUEST.form.get('id'))
 
         if shasattr(self, '_lp_default_page'):
             delattr(self, '_lp_default_page')
Added by Lennart Regebro on Aug 02, 2007 07:11 PM
OK, pasting the diff in was a bad idea. Here it is a an attachement instead.
Attached:
L70.diff — text/plain, 0 Kb
Added by Graham Perrin on Dec 04, 2007 10:00 PM
+1

http://www.nabble.com/custo[…]t-saved-tf4936915s6741.html

LinguaPlone 2.0

Plone 3.0.3
CMF-2.1.0
Zope (Zope 2.10.5-final, python 2.4.4, darwin)
Python 2.4.4 (#1, Nov 17 2007, 19:56:03) [GCC 4.0.1 (Apple Computer, Inc. build 5250)]
PIL 1.1.6
Added by Graham Perrin on Dec 04, 2007 10:01 PM
+1

http://www.nabble.com/custo[…]t-saved-tf4936915s6741.html

LinguaPlone 2.0

Plone 3.0.3
CMF-2.1.0
Zope (Zope 2.10.5-final, python 2.4.4, darwin)
Python 2.4.4 (#1, Nov 17 2007, 19:56:03) [GCC 4.0.1 (Apple Computer, Inc. build 5250)]
PIL 1.1.6
Added by Graham Perrin on Dec 04, 2007 11:55 PM
See also
http://plone.org/products/redirectiontool/issues/4
-- I'm not sure whether it's relevant but Justin Ryan (there) and I both had issues with apparently broken aliases, at some point, whilst uninstalling/removing/replacing/re-installing products (for troubleshooting purposes).

In my case I was juggling a few products, not only LinguaPlone and RedirectionTool -- so I'm not pointing a finger at either product; simply cross-referencing :-)
Added by Graham Perrin on Dec 09, 2007 10:51 PM
I don't know how common it is for site administrators to enable editing of short names but in our case:

 * the majority of content is enfolded (pages within folders)

 * some folders and their contents have extraordinarily long titles.

For example the titles of both this page
http://centrim.mis.brighton.ac.uk/[…]/overview
and its enclosing folder
http://centrim.mis.brighton.ac.uk/[…]/folder_contents
"Creating_games: Mapping and Upgrading Creative Processes for Sustained Innovation — The challenge facing UK Electronic Games Developers" - "Creating_games: Mapping and Upgrading Creative Processes for Sustained Innovation — The challenge facing UK Electronic Games Developers"
led to names that were in no way short :-)

So for us, short names are an important aspect.
Added by Graham Perrin on Dec 19, 2007 03:51 PM
I don't imagine that excess (unrequired) aliases have any impact on performance, but if they are a concern then Redirection Tool http://plone.org/products/redirectiontool may be useful.
Added by Graham Perrin on Sep 10, 2008 06:17 AM
Re
http://n2.nabble.com/Lingua[…]-Folders-ids-tp1075240.html

Two questions:

= 1) Applicability =

Is the patch as originally proposed by Lennart perfectly safe to use with Plone 3.1.5.1?

= 2) Timeline =

Can you estimate when the patch in some form will be included within LinguaPlone?

Thanks
Graham
Added by Graham Perrin on Sep 13, 2008 03:59 PM
I have applied Lennart's patch to my Plone 3.1.5.1 production server.

First test (adding a link with a custom short name): fine.

Discussing with Lennart in IRC…
Added by David Hostetler on Sep 11, 2009 08:50 PM
I have a what I think is a cleaner patch for this.


348,349c348
< is_new_object = self.checkCreationFlag()
<
---
>
355,356c354
< if self._at_rename_after_creation and is_new_object:
< new_id = self._renameAfterCreation()
---
> new_id = self.getId()


Basically -- _renameAfterCreation() doesn't need to be called directly by I18NBaseObject:processForm(). Because BaseObject:processForm() is actually explicitly called just a few lines above, and it does the same thing, only it uses the 'check_auto_id=True' argument.

So -- it appears to me that I18NBaseObject:processForm() included two redundant calls at the top of the function implementation: checkCreationFlag() and _renameAfterCreation().

Removal of that eliminates the override of a user-supplied short name, which can be had easily via self.getId(), and the rest of processForm() can proceed as before.

I'm running this now and don't see any bad side effects, but I don't have any other LinguaPlone familiarity and so this should be reviewed by a core LinguaPlone developer to see if it makes sense.

Cheers.
Added by Hanno Schlichting on Oct 02, 2009 05:18 PM
Issue state: ConfirmedResolved
Target release: 1.0None
This is fixed in LP trunk using the patch by David Hostetler. It will be released as part of LP 3.0b4.

No responses can be added.