Commit dd7ae4fd authored by Ivan Tyagov's avatar Ivan Tyagov

Add useful scripts.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14218 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 35dab720
<?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>"""\n
This script is part of erp5_web.\n
It\'s a sample script sceleton which can be used to create user (Person object) \n
for web interface and sets Person\'s details (address, email, assignment and career). \n
\n
Notes:\n
- This script is normally executed by anonymous user with Manager proxy roles which \n
you have to turn on after adjusting this script to your needs.\n
- this script should be called from respective form which will handle all validation\n
- you have to decide if assignment should be opened automatically or \n
verified and opened by administrator first\n
"""\n
\n
person_module = context.getPortalObject().person_module\n
person = person_module.newContent(portal_type = \'Person\', \n
reference = kw[\'email\'],\n
default_email_text = kw[\'email\'],\n
first_name = kw[\'first_name\'], \n
last_name = kw[\'last_name\'])\n
# create default career\n
career = person.newContent(portal_type=\'Career\', \n
id=\'default_career\', \n
group=kw[\'group\'], \n
function=kw[\'function\'], \n
role=\'internal\')\n
# create assignment\n
assignment = person.newContent(portal_type=\'Assignment\', \n
group=kw[\'group\'], \n
function=kw[\'function\'], \n
site=kw[\'site\'])\n
return person\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>**kw</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Author</string>
</tuple>
</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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>person_module</string>
<string>_getitem_</string>
<string>person</string>
<string>career</string>
<string>assignment</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_createUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create web site user</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<tal:block tal:condition="here/portal_skins/updateSkinCookie | nothing"\n
tal:define="dummy here/setupCurrentSkin;" />\n
<tal:block tal:define="response request/RESPONSE;\n
mtool here/portal_membership;\n
isAnon mtool/isAnonymousUser|nothing;">\n
<tal:block tal:condition="isAnon">\n
<tal:block tal:define="dummy python: response.expireCookie(\'__ac\', path=\'/\');\n
url python: \'%s?came_from=%s&portal_status_message=%s\' % (request[\'came_from\'], request[\'came_from\'], here.getPortalObject().Localizer.translate(\'ui\', \'Sorry,+the+email+adress and/or+the+password+that+you+provided+are+incorrect.\'));\n
dummy python: response.redirect(url);"/>\n
</tal:block>\n
<tal:block tal:condition="not: isAnon">\n
<tal:block tal:define="came_from python: \'%s/group_section\' % request.get(\'came_from\') or here.portal_url() + \'/view\';\n
dummy python: response.redirect(came_from);" />\n
</tal:block>\n
</tal:block>
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_login</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Login Page Template used by login and resitration main page</string> </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