Commit 80cc598d authored by Ivan Tyagov's avatar Ivan Tyagov

Moved to erp5_base as Base_generatePassword.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14231 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f83c6424
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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
This script is part of erp5_web. It generates a human readable random\n
password in the form \'word\'+digits+\'word\'.\n
This method can be overloaded on a per Web Site basis by storing a \n
different script inside each Web Site.\n
\n
from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410076\n
\n
parameters: number of \'characters\' , number of \'digits\'\n
Pradeep Kishore Gowda <pradeep at btbytes.com >\n
License : GPL \n
Date : 2005.April.15\n
Revision 1.2 \n
ChangeLog: \n
1.1 - fixed typos \n
1.2 - renamed functions _apart & _npart to a_part & n_part as zope does not allow functions to \n
start with _\n
"""\n
\n
import string, random\n
vowels = [\'a\',\'e\',\'i\',\'o\',\'u\']\n
consonants = [a for a in string.ascii_lowercase if a not in vowels]\n
digits = string.digits\n
\n
def a_part(slen):\n
ret = \'\'\n
for i in range(slen):\t\t\t\n
if i%2 ==0:\n
randid = random.randint(0,20) #number of consonants\n
ret += consonants[randid]\n
else:\n
randid = random.randint(0,4) #number of vowels\n
ret += vowels[randid]\n
return ret\n
\n
def n_part(slen):\n
ret = \'\'\n
for i in range(slen):\n
randid = random.randint(0,9) #number of digits\n
ret += digits[randid]\n
return ret\n
\n
fpl = alpha/2\t\t\n
if alpha % 2 :\n
fpl = int(alpha/2) + 1 \t\t\t\t\t\n
lpl = alpha - fpl\t\n
\n
start = a_part(fpl)\n
mid = n_part(numeric)\n
end = a_part(lpl)\n
newpass = "%s%s%s" % (start,mid,end)\n
return newpass\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>alpha=6, numeric=2</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>alpha</string>
<string>numeric</string>
<string>string</string>
<string>random</string>
<string>vowels</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>a</string>
<string>consonants</string>
<string>digits</string>
<string>a_part</string>
<string>n_part</string>
<string>fpl</string>
<string>int</string>
<string>lpl</string>
<string>start</string>
<string>mid</string>
<string>end</string>
<string>newpass</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>6</int>
<int>2</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_generatePassword</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Generate human readable random password</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment