Skip to content Flash-fx website
flash-fx logo image1
flash-fx logo image2
Simple solutions to complex problems. Historical swordsmanship Great online resource and forums relating to Maya and 3D.
Home << Tutorials << Plone << Shortname modification

Shortname modification

If you have short name editing disabled in Plone then the page title is used to generate the short name or id of the page. This can result in spaces being hypenated and potentially unwanted characters being used. To remove spacing and underscores from the autogenerated short name do the following:
  • In the filesystem (not via the ZMI) first browse to your Products folder and locate:
    • Archetypes/BaseObject.py
  • Now edit the file (making sure you have a backup) and locate the function:
    • def generateNewId(self):
  • At the bottom of the function comment out the following line like so:
    • # return plone_tool.normalizeString(title)
  • Now add the following code on the line below the commented out line - this will take the title that was given and strip it of whitespaces and underscores:
    • ### simon hack to try and modify the existing title
          def shortname_tidy(string):
              newstring = string
              newstring = newstring.replace(' ','')
              newstring = newstring.replace('_','')
              newstring = newstring.lower();
      
              return newstring
      
          newModID = shortname_tidy(title)
      
          return plone_tool.normalizeString(newModID)