[Pypi-checkins] r745 - in branches/tarek-pep-345-support: . templates

tarek.ziade python-checkins at python.org
Wed Mar 17 03:04:10 CET 2010


Author: tarek.ziade
Date: Wed Mar 17 03:04:09 2010
New Revision: 745

Modified:
   branches/tarek-pep-345-support/store.py
   branches/tarek-pep-345-support/templates/display.pt
   branches/tarek-pep-345-support/templates/standard_template.pt
   branches/tarek-pep-345-support/webui.py
Log:
Added Matthieu work on PEP 345 UI

Modified: branches/tarek-pep-345-support/store.py
==============================================================================
--- branches/tarek-pep-345-support/store.py	(original)
+++ branches/tarek-pep-345-support/store.py	Wed Mar 17 03:04:09 2010
@@ -656,6 +656,37 @@
         safe_execute(cursor, 'update packages set autohide=%s where name=%s',
                      [value, name])
 
+    def get_package_requires_dist(self, name, version):
+        cursor = self.get_cursor()
+        safe_execute(cursor, '''select specifier from release_requires_dist 
+            where name=%s and version=%s ''', (name, version))
+        packages = []
+        for package in cursor.fetchall():
+            pack = {'name':package[0],
+                    'href' :"%s/%s"%(self.config.url, package[0])}
+            packages.append(pack)
+        return packages
+
+    def get_package_provides_dist(self, name, version):
+        cursor = self.get_cursor()
+        safe_execute(cursor, '''select specifier from release_provides_dist 
+            where name=%s and version=%s ''', (name, version))
+        packages = []
+        for package in cursor.fetchall():
+            pack = {'name':package[0],
+                    'href' :"%s/%s"%(self.config.url, package[0])}
+            packages.append(pack)
+        return packages
+
+    def get_package_project_url(self, name, version):
+        cursor = self.get_cursor()
+        safe_execute(cursor, '''select specifier from release_project_url 
+            where name=%s and version=%s ''', (name, version))
+        project_urls = []
+        for project in cursor.fetchall():
+            project_urls.append(project[0].split(','))
+        return project_urls
+
     def get_package_comments(self, name):
         cursor = self.get_cursor()
         safe_execute(cursor, 'select comments from packages where name=%s',

Modified: branches/tarek-pep-345-support/templates/display.pt
==============================================================================
--- branches/tarek-pep-345-support/templates/display.pt	(original)
+++ branches/tarek-pep-345-support/templates/display.pt	Wed Mar 17 03:04:09 2010
@@ -156,6 +156,27 @@
   </ul>
  </li>
 
+
+ <li tal:condition="data/requires_dist | nothing">
+   <strong>Requires</strong>
+   <ul class="nodot">
+     <li tal:repeat="require data/requires_dist">
+       <a tal:attributes="href require/href"
+	  tal:content="require/name"/>
+     </li>
+   </ul>
+ </li>
+
+ <li tal:condition="data/provides_dist | nothing">
+   <strong>Provides</strong>
+   <ul class="nodot">
+     <li tal:repeat="provide data/provides_dist">
+       <a tal:attributes="href provide/href"
+	  tal:content="provide/name"/>
+     </li>
+   </ul>
+ </li>
+
  <li tal:condition="data/roles/Owner | nothing">
   <strong>Package Index Owner:</strong>
   <span tal:content="python:', '.join(data['roles']['Owner'])" />

Modified: branches/tarek-pep-345-support/templates/standard_template.pt
==============================================================================
--- branches/tarek-pep-345-support/templates/standard_template.pt	(original)
+++ branches/tarek-pep-345-support/templates/standard_template.pt	Wed Mar 17 03:04:09 2010
@@ -14,14 +14,111 @@
        <link rel="stylesheet" tal:attributes="href string:${app/config/pydotorg}css/pypi.css" type="text/css"/>
 
        <link rel="alternate" type="application/rss+xml" title="RSS: 30 latest updates" href="http://www.python.org/pypi?:action=rss"/>
-      <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/screen-switcher-default.css" type="text/css" id="screen-switcher-stylesheet" rel="stylesheet" />
-      <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/netscape4.css" type="text/css" rel="stylesheet" />
-      <link media="print" tal:attributes="href string:${app/config/pydotorg}styles/print.css" type="text/css" rel="stylesheet" />
-      <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/largestyles.css" type="text/css" rel="alternate stylesheet" title="large text" />
-      <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/defaultfonts.css" type="text/css" rel="alternate stylesheet" title="default fonts" />
-      <link rel="stylesheet" media="screen" href="/css/docutils.css" type="text/css"/>
+       <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/screen-switcher-default.css" type="text/css" id="screen-switcher-stylesheet" rel="stylesheet" />
+       <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/netscape4.css" type="text/css" rel="stylesheet" />
+       <link media="print" tal:attributes="href string:${app/config/pydotorg}styles/print.css" type="text/css" rel="stylesheet" />
+       <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/largestyles.css" type="text/css" rel="alternate stylesheet" title="large text" />
+       <link media="screen" tal:attributes="href string:${app/config/pydotorg}styles/defaultfonts.css" type="text/css" rel="alternate stylesheet" title="default fonts" />
+       <link rel="stylesheet" media="screen" href="/css/docutils.css" type="text/css"/>
       
-      <metal:slot define-slot="head" />
+       <metal:slot define-slot="head" />
+
+       <style type="text/css" rel="stylesheet">
+	 #document-floating {
+  	   width: 15em;
+	 }
+	 .floating-box {
+	   float: right;
+	 }
+	 .homepage-box h4, #document-project-url h4, .externallinks h4
+	 {
+	 font-family: Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif;
+	 font-size: 88%;
+	 font-weight: bold;
+	 padding: 3px 0 4px 12px;
+	 margin-bottom:8px;
+	 border-bottom:3px solid #d5ad42;
+	 background-color: #F4F4F4;
+	 text-align: left;
+	 z-index: 0;
+	 -moz-border-radius-topleft: 16px;
+	 }
+
+	 #document-project-url h4, .homepage-box h4, .externallinks h4 {
+	 -moz-border-radius-topleft:11px;
+	 background-color:#376A94;
+	 color:#FFFFFF;
+	 font-family:Arial,Verdana,Geneva,"Bitstream Vera Sans",Helvetica,sans-serif;
+	 font-size:94%;
+	 font-weight:bold;
+	 margin:0;
+	 padding:3px 0 4px 12px;
+	 text-align:left;
+	 z-index:0;
+	 }
+
+	 #document-project-url
+	 {
+	 font-family: Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif;
+	 font-size:  98%;
+	 text-align: left;
+	 color: #3C4B6B;
+	 background-color: #F7F6F0;
+	 width: 15em;
+	 border: 1px solid #B7BECC;
+	 z-index: 999;
+	 float:right;
+	 margin: 0 12px 12px 12px;
+	 padding-bottom: 10px;
+	 list-style:none;
+	 -moz-border-radius-topleft: 12px;
+	 -moz-border-radius-bottomright: 12px;
+	 }
+	 
+	 #document-project-url ul
+	 {
+	 list-style: none;
+	 display: block;
+	 border:0;
+	 padding: 0;
+	 margin: 0 3em 0 1.1em;
+	 color: #3C4B6B;
+	 background: none;
+	 width: auto;
+	 font-size: 103%;
+	 font-family: Verdana, Geneva, "Bitstream Vera Sans", Helvetica, sans-serif; 
+	 }
+	 
+	 #document-project-url a:link, #document-project-url a:visited 
+	 {
+	 color:#3C4B6B;
+	 text-decoration:  none;
+	 }
+	 
+	 #document-project-url a:hover
+	 {
+	 color: #000000;
+	 text-decoration: underline;
+	 }
+	 
+	 #document-project-url h4 a:link, #document-project-url  h4 a:visited
+	 {
+	 color: #FFFFFF;
+	 }
+	 
+
+	 #document-project-url h4 a:hover
+	 {
+	 color: #FFFFFF;
+	 
+	 }
+	 #document-project-url form {
+	 margin:12px;
+	 }
+	 #document-project-url input {
+	 margin-top:3px;
+	 }
+       </style>
     </head>
     <body>
       <!--  Logo  -->
@@ -106,58 +203,73 @@
               
             </div>
 
-            <div id="document-navigation" style="overflow-y: auto; max-height: 15em; overflow-x: hidden;">
-              <tal:if-not-user condition="not: app/loggedin">
-                <h4>Not Logged In</h4>
-
-                <ul>
-		  <li tal:condition="app/username"><a tal:attributes="href python:app.link_action('clear_auth')">Clear Basic Auth</a></li>
-                  <li><a tal:attributes="href python: app.link_action('login')">Login</a></li>
-                  <li><a tal:attributes="href python: app.link_action('register_form')">Register</a></li>
-                  <li><a tal:attributes="href python: app.link_action('forgotten_password_form')">Lost Login?</a></li>
-		  <li>Use <a tal:attributes="href string:${app/url_path}?:action=openid">OpenID</a>
-                    <tal:block tal:repeat="prov data/providers">
-                     <a tal:attributes="href prov/login">
-                     <img tal:attributes="src prov/favicon; title prov/title"/>
-                     </a>
-                    </tal:block>
-                  </li>
-                </ul>
-
-              </tal:if-not-user>
-
-              <tal:if-user condition="app/loggedin">
-
-                <h4>Welcome <span tal:replace="app/username"/></h4>
-                <li>
-                  <a tal:attributes="href python:app.link_action('user_form')">Your details</a>
-                </li>
+	    <div id="document-floating" class="floating-box">
 
-                <tal:let define="packages python:app.store.user_packages(app.username)">
-                  <tal:if-packages condition="packages">
-                    <li>
-                      Your packages:
+              <div id="document-navigation" class="floating-box">
+		<tal:if-not-user condition="not: app/loggedin">
+                  <h4>Not Logged In</h4>
+
+                  <ul>
+		    <li tal:condition="app/username"><a tal:attributes="href python:app.link_action('clear_auth')">Clear Basic Auth</a></li>
+                    <li><a tal:attributes="href python: app.link_action('login')">Login</a></li>
+                    <li><a tal:attributes="href python: app.link_action('register_form')">Register</a></li>
+                    <li><a tal:attributes="href python: app.link_action('forgotten_password_form')">Lost Login?</a></li>
+		    <li>Use <a tal:attributes="href string:${app/url_path}?:action=openid">OpenID</a>
+                      <tal:block tal:repeat="prov data/providers">
+			<a tal:attributes="href prov/login">
+                       <img tal:attributes="src prov/favicon; title prov/title"/>
+			</a>
+                      </tal:block>
                     </li>
-                    <ul>
-                      
+                  </ul>
+		  
+		</tal:if-not-user>
+		
+		<tal:if-user condition="app/loggedin">
+
+                  <h4>Welcome <span tal:replace="app/username"/></h4>
+                  <li>
+                    <a tal:attributes="href python:app.link_action('user_form')">Your details</a>
+                  </li>
+		  
+                  <tal:let define="packages python:app.store.user_packages(app.username)">
+                    <tal:if-packages condition="packages">
                       <li>
-                        <tal:block repeat="pkg_info packages">
-                          <a tal:attributes="href python: app.link_action('pkg_edit', name=pkg_info[0])"
-                             tal:content="python:pkg_info[0]">package</a><br />
-                        </tal:block>
+			Your packages:
                       </li>
-                    </ul>
-                  </tal:if-packages>
-                </tal:let>
-
-                <li>
-                  <a tal:attributes="href python:app.link_action('logout')">Logout</a>
-                </li>
-              </tal:if-user>
+                      <ul>                      
+			<li>
+                          <tal:block repeat="pkg_info packages">
+                            <a tal:attributes="href python: app.link_action('pkg_edit', name=pkg_info[0])"
+                               tal:content="python:pkg_info[0]">package</a><br />
+                          </tal:block>
+			</li>
+                      </ul>
+                    </tal:if-packages>
+                  </tal:let>
 
+                  <li>
+                    <a tal:attributes="href python:app.link_action('logout')">Logout</a>
+                  </li>
+		</tal:if-user>
             
             </div>
 
+	    <tal:block condition="data/project_url | nothing">
+	      <div id="document-project-url" class="floating-box">
+		<h4>Project-URL</h4>
+		<ul>
+		  <tal:block tal:repeat="project data/project_url">
+		    <li>
+		      <a tal:content="python:project[0]" tal:attributes="href python:project[1]"></a>
+		    </li>
+		  </tal:block>
+		</ul>
+	      </div>
+	    </tal:block>
+
+	    </div>
+
             <div class="section">
 
               <h1 tal:content="data/title"></h1>

Modified: branches/tarek-pep-345-support/webui.py
==============================================================================
--- branches/tarek-pep-345-support/webui.py	(original)
+++ branches/tarek-pep-345-support/webui.py	Wed Mar 17 03:04:09 2010
@@ -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
@@ -1223,6 +1223,11 @@
             total += r['rating']
             tally[r['rating']] += 1
 
+        # New metadata
+        requires_dist = self.store.get_package_requires_dist(name, version)
+        provides_dist = self.store.get_package_provides_dist(name, version)
+        project_url = self.store.get_package_project_url(name, version)
+
         for c in comments:
             add = c, []
             parent_comments[c['id']] = add[1]
@@ -1288,7 +1293,10 @@
                             usinglatest=using_latest,
                             latestversion=latest_version,
                             latestversionurl=latest_version_url,
-                            action=self.link_action())
+                            action=self.link_action(),
+                            requires_dist=requires_dist,
+                            provides_dist=provides_dist,
+                            project_url=project_url)
 
     def index(self, nav_current='index', releases=None):
         ''' Print up an index page


More information about the Pypi-checkins mailing list