Commits

Anonymous committed 4e245e9

metaweblog api fix for uploadimg files

  • Participants
  • Parent commits 98fd4af

Comments (0)

Files changed (1)

File apps/xmlrpc/metaweblog.py

         raise Fault(-1, "Authentication Failure")
 
     try:
-        post = Post.objects.get(id=postid)
+        post = Post.all_objects.get(pk=postid)
         post.name = content['title']
         post.text = content['description']
         post.date = datetime_from_content(content)
         return Fault(-1, "Authentication Failure")
 
     try:
-        post = Post.objects.get(pk=postid)
+        post = Post.all_objects.get(pk=postid)
         return post_struct(post)
     except Post.DoesNotExist:
         raise Fault(-2, "Post does not exist")
 
     file_data = str(fileObject['bits'])
     file_name = str(fileObject['name'])
-    dated_path = datetime.datetime.now().strftime('%Y_%m_%d_') + os.path.basename(file_name)
+    dated_path = datetime.now().strftime('%Y_%m_%d_') + os.path.basename(file_name)
     relative_path = os.path.join('upload', dated_path)
     target_path = os.path.abspath(os.path.join(settings.STATIC_ROOT, relative_path))
-    target_url = os.path.abspath(settings.STATIC_ROOT, relative_path)
+    target_url = os.path.join(settings.STATIC_ROOT, relative_path)
     open(target_path, 'w').write(file_data)
     return target_url