[Pypi-checkins] r826 - in trunk/pypi: . templates

georg.brandl python-checkins at python.org
Sun Jul 25 19:55:00 CEST 2010


Author: georg.brandl
Date: Sun Jul 25 19:55:00 2010
New Revision: 826

Added:
   trunk/pypi/templates/confirm.pt
Modified:
   trunk/pypi/templates/message.pt
   trunk/pypi/templates/register.pt
   trunk/pypi/webui.py
Log:
As per catalog-sig discussion, move usage agreement to after email roundtrip, to keep python setup.py register working for new users.

Added: trunk/pypi/templates/confirm.pt
==============================================================================
--- (empty file)
+++ trunk/pypi/templates/confirm.pt	Sun Jul 25 19:55:00 2010
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      metal:use-macro="standard_template/macros/page">
+  <metal:fill fill-slot="body">
+
+    <form tal:attributes="action app/url_path" method="POST">
+      <input type="hidden" name=":action" value="user" />
+      <input type="hidden" name="agree_shown" value="1" />
+      <input type="hidden" name="otk" tal:attributes="value data/otk" />
+      <p>
+        <b>User name: <span tal:replace="data/user" /></b>
+      </p>
+      <p>
+        By registering to upload content to PyPI, I agree and affirmatively
+        acknowledge the following:
+      </p>
+      <ol>
+        <li>
+          Content is restricted to Python packages and related information only.
+        </li>
+        <li>
+          Any content uploaded to PyPI is provided on a non-confidential basis.
+        </li>
+        <li>
+          The PSF is free to use or disseminate any content that I upload on an
+          unrestricted basis for any purpose. In particular, the PSF and all
+          other users of the web site are granted an irrevocable, worldwide,
+          royalty-free, nonexclusive license to reproduce, distribute, transmit,
+          display, perform, and publish the content, including in digital form.
+        </li>
+        <li>
+          I represent and warrant that I have complied with all government
+          regulations concerning the transfer or export of any content I upload
+          to PyPI.  In particular, if I am subject to United States law, I
+          represent and warrant that I have obtained the proper governmental
+          authorization for the export of the content I upload. I further affirm
+          that any content I provide is not intended for use by a government
+          end-user as defined in part 772 of the United States Export
+          Administration Regulations.
+        </li>
+      </ol>
+      <p><input type="checkbox" name="agree"> I agree</input></p>
+      <p><input type="submit" value="Confirm" /></p>
+    </form>
+  </metal:fill>
+</html>

Modified: trunk/pypi/templates/message.pt
==============================================================================
--- trunk/pypi/templates/message.pt	(original)
+++ trunk/pypi/templates/message.pt	Sun Jul 25 19:55:00 2010
@@ -5,5 +5,8 @@
       metal:use-macro="standard_template/macros/page">
   <metal:fill fill-slot="body">
     <p tal:condition="data/message" tal:content="data/message"></p>
+    <p tal:condition="exists:data/url">
+      <a tal:attributes="href data/url" tal:content="data/url_text"></a>
+    </p>
   </metal:fill>
 </html>

Modified: trunk/pypi/templates/register.pt
==============================================================================
--- trunk/pypi/templates/register.pt	(original)
+++ trunk/pypi/templates/register.pt	Sun Jul 25 19:55:00 2010
@@ -44,29 +44,6 @@
           key</a>)
           </td>
 	</tr>
-	<tr tal:condition="data/new_user">
-           <th>Usage Agreement:</th>
-	   <td>By registering to upload content to PyPI, I agree and affirmatively 
-	    acknowledge the following:
-	    <ol>
-	      <li>Content is restricted to Python packages and related information only.</li>
-	      <li>Any content uploaded to PyPI is provided on a non-confidential basis.</li>
-	      <li>The PSF is free to use or disseminate any content that I upload on an 
-		unrestricted basis for any purpose. In particular, the PSF and all other 
-		users of the web site are granted an irrevocable, worldwide, royalty-free, 
-		nonexclusive license to reproduce, distribute, transmit, display, perform, 
-		and publish the content, including in digital form.</li>
-	      <li>I represent and warrant that I have complied with all government 
-		regulations concerning the transfer or export of any content I upload to PyPI.  
-		In particular, if I am subject to United States law, I represent and warrant 
-		that I have obtained the proper governmental authorization for the export of 
-		the content I upload. I further affirm that any content I provide is not intended 
-		for use by a government end-user as defined in part 772 of the United States 
-		Export Administration Regulations.</li>
-	    </ol>
-	    <input type="checkbox" name="agree">I agree</input>
-	    </td>
-	</tr>
 	<tr>
 	  <th></th>
 	  <td><input type="submit" tal:attributes="value data/action" /></td>

Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py	(original)
+++ trunk/pypi/webui.py	Sun Jul 25 19:55:00 2010
@@ -2505,11 +2505,25 @@
             # finish off rego
             if self.store.get_otk(info['otk']):
                 response = 'Error: One Time Key invalid'
-            else:
+            elif self.form.has_key('agree_shown'):
+                # user has posted the form with the usage agreement
+                if not self.form.has_key('agree'):
+                    self.fail('You need to confirm the usage agreement.',
+                              heading='User registration')
+                    return
                 # OK, delete the key
                 self.store.delete_otk(info['otk'])
-                response = 'Registration complete'
-
+                self.write_template('message.pt', title='Registration complete',
+                                    message='You are now registered.',
+                                    url='%s?:action=login' % self.url_path,
+                                    url_text='Proceed to login')
+                return
+            else:
+                # user has clicked the link in the email -- show agreement form
+                user = self.store.get_user_by_otk(info['otk'])
+                self.write_template('confirm.pt', title='Confirm registration',
+                                    otk=info['otk'], user=user)
+                return
         elif self.username is None:
             for param in 'name email'.split():
                 if not info.has_key(param):
@@ -2563,10 +2577,6 @@
                 self.fail('user "%s" already exists'%name,
                     heading='User registration')
                 return
-            if not self.form.has_key('agree'):
-                self.fail('You need to confirm the usage agreement.',
-                          heading='User registration')
-                return
             olduser = self.store.get_user_by_email(info['email'])
             if olduser:
                 raise FormError, 'You have already registered as user '+olduser['name']


More information about the Pypi-checkins mailing list