[Pypi-checkins] r749 - branches/tarek-pep-345-support

tarek.ziade python-checkins at python.org
Sun Mar 21 00:00:57 CET 2010


Author: tarek.ziade
Date: Sun Mar 21 00:00:57 2010
New Revision: 749

Modified:
   branches/tarek-pep-345-support/webui.py
Log:
now reading PEP 345 fields

Modified: branches/tarek-pep-345-support/webui.py
==============================================================================
--- branches/tarek-pep-345-support/webui.py	(original)
+++ branches/tarek-pep-345-support/webui.py	Sun Mar 21 00:00:57 2010
@@ -335,7 +335,6 @@
         template_dir = os.path.join(os.path.dirname(__file__), 'templates')
         context['standard_template'] = PyPiPageTemplate(
             "standard_template.pt", template_dir)
-
         template = PyPiPageTemplate(filename, template_dir)
         content = template(**context)
 
@@ -1021,7 +1020,8 @@
     def display_pkginfo(self, name=None, version=None):
         '''Reconstruct and send a PKG-INFO metadata file.
         '''
-
+        # XXX tarek need to add 1.2 support here
+        #
         info, name, version = self._get_pkg_info(name, version)
         if not info:
             return self.fail('No such package / version',
@@ -1211,7 +1211,7 @@
 
         # Compute rating data
         has_rated = self.loggedin and self.store.has_rating(name, version)
-        latest_rating = self.loggedin and self.store.latest_rating(name)        
+        latest_rating = self.loggedin and self.store.latest_rating(name)
         ratings, comments = self.store.get_ratings(name, version)
         total = 0.0
         hcomments = [] # as a hierarchy
@@ -1264,7 +1264,7 @@
                         rating = ', %s points' % rating
                 else:
                     rating = ''
-                result.append("<li>%s (%s%s):<br/>%s %s" % 
+                result.append("<li>%s (%s%s):<br/>%s %s" %
                                 (c['user'], date, rating, message, reply))
                 if children:
                     result.extend(render_comments(children, False))
@@ -1577,7 +1577,10 @@
             data['platform'] = ','.join(data['platform'])
 
         # make sure relationships are lists
-        for name in ('requires', 'provides', 'obsoletes'):
+        for name in ('requires', 'provides', 'obsoletes',
+                     'requires_dist', 'provides_dist',
+                     'obsoletes_dist', 'requires_python',
+                     'requires_external', 'project_url'):
             if data.has_key(name) and not isinstance(data[name],
                     types.ListType):
                 data[name] = [data[name]]
@@ -1679,7 +1682,10 @@
             v = self.form[k]
             if k == '_pypi_hidden':
                 v = v == '1'
-            elif k in ('requires', 'provides', 'obsoletes'):
+            elif k in ('requires', 'provides', 'obsoletes',
+                       'requires_dist', 'provides_dist',
+                       'obsoletes_dist', 'requires_python',
+                       'requires_external', 'project_url'):
                 if not isinstance(v, list):
                     v = [x.strip() for x in re.split('\s*[\r\n]\s*', v)]
                 else:
@@ -1697,7 +1703,10 @@
             data[k.lower()] = v
 
         # make sure relationships are lists
-        for name in ('requires', 'provides', 'obsoletes'):
+        for name in ('requires', 'provides', 'obsoletes',
+                     'requires_dist', 'provides_dist',
+                     'obsoletes_dist', 'requires_python',
+                     'requires_external', 'project_url'):
             if data.has_key(name) and not isinstance(data[name],
                     types.ListType):
                 data[name] = [data[name]]
@@ -1758,6 +1767,8 @@
             except ValueError, message:
                 raise ValueError, 'Bad "provides" syntax: %s'%message
 
+        # XXX tarek todo : check PEP 345 fields
+        #
         # check classifiers
         if data.has_key('classifiers'):
             d = {}
@@ -1874,7 +1885,7 @@
         if not self.form.has_key('msg'):
             raise FormError
         comment = self.store.get_comment(self.form['msg'])
-        self.write_template('comment.pt', title='Reply to comment', 
+        self.write_template('comment.pt', title='Reply to comment',
                             comment=comment)
 
     def addcomment(self):
@@ -1898,7 +1909,7 @@
         comment_email(self.store, name, version, self.username, comment, [orig['user']])
 
         return self.display(name=name, version=version)
-        
+
 
     def delcomment(self):
         if not self.authenticated:
@@ -2724,15 +2735,15 @@
         return self.register_form()
 
     def rp_discovery(self):
-        payload = '''<xrds:XRDS  
-                xmlns:xrds="xri://$xrds"  
-                xmlns="xri://$xrd*($v*2.0)">  
-                <XRD>  
-                     <Service priority="1">  
-                              <Type>http://specs.openid.net/auth/2.0/return_to</Type>  
-                              <URI>%s</URI>  
-                     </Service>  
-                </XRD>  
+        payload = '''<xrds:XRDS
+                xmlns:xrds="xri://$xrds"
+                xmlns="xri://$xrd*($v*2.0)">
+                <XRD>
+                     <Service priority="1">
+                              <Type>http://specs.openid.net/auth/2.0/return_to</Type>
+                              <URI>%s</URI>
+                     </Service>
+                </XRD>
                 </xrds:XRDS>
         ''' % (self.config.url+'?:action=openid_return')
         self.handler.send_response(200)


More information about the Pypi-checkins mailing list