Revision: 2291
Author: KariHusa
Date: Thu Oct 15 03:48:10 2009
Log: cleanup
http://code.google.com/p/robotframework/source/detail?r=2291

Modified:
 /trunk/tools/libdoc/rfdoc_uploader.py

=======================================
--- /trunk/tools/libdoc/rfdoc_uploader.py       Thu Oct 15 03:34:13 2009
+++ /trunk/tools/libdoc/rfdoc_uploader.py       Thu Oct 15 03:48:10 2009
@@ -1,8 +1,8 @@
-"""Robot Framework Library and Resource File Documentation Uploader
+"""Robot Framework Library Uploader

 Usage:  python rfdoc_uploader.py url file_name [--o]
 options:
- --o Overwrites the documentation in the server, if it already exists.
+    --o    Overwrites the library in the server, if it already exists.
 """

 import sys
@@ -15,8 +15,8 @@
     def upload(self, file_path, url, override=True):
         fields = {'override': 'true'}
         resp = self._post_multipart(url, fields, file_path, override)
-        success = self._validate_success(resp)
-        print 'SUCCESS: ', success
+        return self._validate_success(resp)
+

     def _post_multipart(self, host, fields, file_path, override):
content_type, body = self._encode_multipart_formdata(file_path, override)
@@ -54,8 +54,7 @@
         status = resp.status
         reason = resp.reason
         html = resp.read()
-        print html
- if status is not '200' and re.search('Successfully uploaded library', html): + if status is 200 and re.search('Successfully uploaded library', html):
             return True
         # TODO parse error messages
         return False
@@ -73,7 +72,10 @@
         else:
             print __doc__
             sys.exit()
-    RFDocUploader().upload(file_path, url, override)
+    if RFDocUploader().upload(file_path, url, override):
+        print 'Library successfully uploaded!'
+    else:
+        print 'Failed to upload library!'

 if __name__ == '__main__':
     main(sys.argv[1:])

Reply via email to