gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20743 - gnunet/src/gns/proxy


From: gnunet
Subject: [GNUnet-SVN] r20743 - gnunet/src/gns/proxy
Date: Sat, 24 Mar 2012 13:35:30 +0100

Author: schanzen
Date: 2012-03-24 13:35:30 +0100 (Sat, 24 Mar 2012)
New Revision: 20743

Modified:
   gnunet/src/gns/proxy/proxy.py
Log:
-add zkey shortening


Modified: gnunet/src/gns/proxy/proxy.py
===================================================================
--- gnunet/src/gns/proxy/proxy.py       2012-03-24 11:53:33 UTC (rev 20742)
+++ gnunet/src/gns/proxy/proxy.py       2012-03-24 12:35:30 UTC (rev 20743)
@@ -82,6 +82,9 @@
             soc.close()
             self.connection.close()
 
+    def shorten_zkey(self):
+      return lambda mo: 'a href="http://'+os.popen("gnunet-gns 
-s"+string.replace(mo.group(1), 'a href="http://', "")).readlines()[0].split(" 
")[-1].rstrip()
+
     def replace_and_shorten(self, to_repl):
       return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s 
"+string.replace(mo.group(1)+to_repl, 'a href="http://', 
"")).readlines()[0].split(" ")[-1].rstrip()
     #full = string.replace(mo.group(1)+to_repl, 'a href="http://', "")
@@ -135,11 +138,13 @@
                         out = soc
                     data = i.recv(8192)
                     if data:
-                        if (re.match("(\w+\.)*gnunet", self.host_port[0]) or 
1):
+                        if (re.match("(\w+\.)*gnunet", self.host_port[0])):
                             arr = self.host_port[0].split('.')
                             arr.pop(0)
                             data = re.sub('(a href="http://(\w+\.)*)(\+)',
                                 self.replace_and_shorten(to_repl), data)
+                        data = re.sub('(a href="http://(\w+\.)*zkey)',
+                            self.shorten_zkey(), data)
                         #print data
                         out.send(data)
                         count = 0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]