[Checkins] SVN: hurry.tinymce/trunk/src/hurry/tinymce/download.py Change download behaviour to match the current TinyMCE download infrastructure.

Sebastian Wehrmann sw at gocept.com
Wed Sep 7 04:51:42 EST 2011


Log message for revision 122737:
  Change download behaviour to match the current TinyMCE download infrastructure.

Changed:
  U   hurry.tinymce/trunk/src/hurry/tinymce/download.py

-=-
Modified: hurry.tinymce/trunk/src/hurry/tinymce/download.py
===================================================================
--- hurry.tinymce/trunk/src/hurry/tinymce/download.py	2011-09-07 09:50:46 UTC (rev 122736)
+++ hurry.tinymce/trunk/src/hurry/tinymce/download.py	2011-09-07 09:51:42 UTC (rev 122737)
@@ -2,7 +2,7 @@
 import tempfile, shutil
 import os
 
-SF_URL_TEMPLATE = 'http://sourceforge.net/project/downloading.php?groupname=tinymce&filename=tinymce_%s.zip'
+GH_URL_TEMPLATE = 'https://github.com/downloads/tinymce/tinymce/tinymce_%s.zip'
 
 def download(version, callback):
     """Download a tinymce of version.
@@ -11,18 +11,13 @@
     with an extracted tinymce. The callback will then be able to copy
     this to the appropriate location.
     """
-    url = SF_URL_TEMPLATE % version.replace('.', '_')
+    url = GH_URL_TEMPLATE % version
     f = urllib2.urlopen(url)
-    data = f.read()
-    f.close()
-
-    download_url = find_a_href(data, 'direct link')
-
-    f = urllib2.urlopen(download_url)
     file_data = f.read()
     f.close()
 
     dirpath = tempfile.mkdtemp()
+    import pdb; pdb.set_trace() 
     try:
         tinymce_path = os.path.join(dirpath, 'tinymce.zip')
         ex_path = os.path.join(dirpath, 'tinymce_ex')
@@ -33,13 +28,3 @@
         callback(ex_path)
     finally:
         shutil.rmtree(dirpath, ignore_errors=True)
-
-def find_a_href(data, content):
-    """Given start of content of the <a href="">content</a> find href.
-    """
-    i = data.find(content)
-    a = '<a href="'
-    href_start = data.rfind(a, 0, i)
-    href_start += len(a)
-    href_end = data.find('"', href_start)
-    return data[href_start:href_end]



More information about the checkins mailing list