Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
4e61744b
Commit
4e61744b
authored
Jul 27, 2015
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_discussion: Base_generateReferenceFromString
parent
c854d3bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/Base_generateReferenceFromString.xml
...kins/erp5_discussion/Base_generateReferenceFromString.xml
+88
-0
No files found.
bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/Base_generateReferenceFromString.xml
0 → 100644
View file @
4e61744b
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
"""\n
Generate reference from a string by escaping all non ascii characters.\n
XXX: add support for non-ascii characters using unidecode python library\n
"""\n
transliterate_list = [\'?\', \':\', \';\', \'/\', \'&\', \'=\', \'^\', \'@\', \'>
\', \'
<
\', \']\', \'[\', \'^\', \'\\\\\']\n
\n
def removeNonAscii(s): \n
return "".join(i for i in s if ord(i)>44 and ord(i)
<123
)\n
\n
#
reference
can
be
used
for
permanent
URL
so
be
friendly
to
spaces
(SEO)\n
s =
s.strip()\n
s =
s.replace(\'
\',
\'-\')\n
\n
s =
removeNonAscii(s)\n
for
item
in
transliterate_list:\n
s =
s.replace(item,
\'-\')\n
\n
return
s.strip(\'-\')\n
]]
></string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
s
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_generateReferenceFromString
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment