[Pypi-checkins] r929 - trunk/pypi

martin.von.loewis python-checkins at python.org
Sun Jul 10 21:57:15 CEST 2011


Author: martin.von.loewis
Date: Sun Jul 10 21:57:08 2011
New Revision: 929

Modified:
   trunk/pypi/rpc.py
   trunk/pypi/store.py
Log:
Add changed_packages RPC.


Modified: trunk/pypi/rpc.py
==============================================================================
--- trunk/pypi/rpc.py	(original)
+++ trunk/pypi/rpc.py	Sun Jul 10 21:57:08 2011
@@ -23,6 +23,7 @@
         self.register_function(search)
         self.register_function(updated_releases)
         self.register_function(changelog)
+        self.register_function(changed_packages)
         self.register_function(post_cheesecake_for_release)
         self.register_introspection_functions()
         self.register_multicall_functions()
@@ -112,6 +113,9 @@
              row['action'])
              for row in result]
 
+def changed_packages(store, since):
+    return store.changed_packages(since)
+
 def post_cheesecake_for_release(store, name, version, score_data, password):
     if password != store.config.cheesecake_password:
         raise ValuError("Bad password.")

Modified: trunk/pypi/store.py
==============================================================================
--- trunk/pypi/store.py	(original)
+++ trunk/pypi/store.py	Sun Jul 10 21:57:08 2011
@@ -841,6 +841,14 @@
 
         return Result(None, cursor.fetchall(), self._Changelog)
 
+    def changed_packages(self, since):
+        "Fetch names of packages changed 'since'"
+        assert isinstance(since, int)
+        cursor = self.get_cursor()
+        safe_execute(cursor, 'select distinct(name) from journals where submitted_date > %s',
+                     (time.gmtime(since),))
+        return cursor.fetchall()
+
     def changelog_last_hour(self):
         return self.changelog(int(time.time())-3600)
 


More information about the Pypi-checkins mailing list