Changeset 957

Show
Ignore:
Timestamp:
Tue Mar 21 22:51:54 2006
Author:
anonymous
Message:

修改rpc,可以使用zoundry来编辑blog了

Files:

Legend:

Unmodified
Added
Removed
Modified
  • zqlib/tangle/limodou/blog/trunk/blog/apps/profile/manipulator.py

    r925 r957  
    123 123  
    124 124     def __call__(self, field_data, all_data):  
    125           if not (self.lower < int(field_data) < self.higher):  
      125         if not (self.lower <= int(field_data) <= self.higher):  
    125 125             raise ValidationError, self.error_message  
  • zqlib/tangle/limodou/blog/trunk/blog/apps/frontpage/views.py

    r951 r957  
    15 15      
    16 16     #blogers  
    17       blogers = User.objects.all().extra(where=['is_superuser<>1'])  
      17     blogers = User.objects.all().exclude(is_superuser=True)  
    17 17     d = []  
    18 18     for b in blogers:  
    22 22     d.sort()  
    23 23     d.reverse()  
    24       print d  
    25 24          
    26 25     context = RequestContext(request, {'page':page, 'bulletins':bulletins, 'blogers':d})  
  • zqlib/tangle/limodou/blog/trunk/blog/apps/woodlog/rpcs/moveabletype.py

    r804 r957  
    4 4 """  
    5 5  
    6   from blog.utils.rpcdispatch import *  
      6 from utils.rpcdispatch import *  
    6 6  
    7   rpccalls = dispatch('blog.woodlog.api.moveabletype',  
      7 rpccalls = dispatch('apps.woodlog.api.moveabletype',  
    7 7     ('mt.getCategoryList', 'getCategoryList'),  
    8 8     ('mt.setPostCategories', 'setPostCategories'),  
  • zqlib/tangle/limodou/blog/trunk/blog/apps/woodlog/rpcs/blogger.py

    r804 r957  
    4 4 """  
    5 5  
    6   from blog.utils.rpcdispatch import *  
      6 from utils.rpcdispatch import *  
    6 6  
    7   rpccalls = dispatch('blog.woodlog.api.blogger',  
      7 rpccalls = dispatch('apps.woodlog.api.blogger',  
    7 7     ('blogger.getUsersBlogs', 'getUsersBlogs'),  
    8 8     ('blogger.getUserInfo', 'getUserInfo'),  
  • zqlib/tangle/limodou/blog/trunk/blog/apps/woodlog/rpcs/metaweblog.py

    r804 r957  
    4 4 """  
    5 5  
    6   from blog.utils.rpcdispatch import *  
      6 from utils.rpcdispatch import *  
    6 6  
    7   rpccalls = dispatch('blog.woodlog.api.metaweblogapi',  
      7 rpccalls = dispatch('apps.woodlog.api.metaweblogapi',  
    7 7     ('metaWeblog.newPost', 'newPost'),  
    8 8     ('metaWeblog.getPost', 'getPost'),  
      9     ('metaWeblog.editPost', 'editPost'),  
    9 10     ('metaWeblog.getRecentPosts', 'getRecentPosts'),  
    10 11     ('metaWeblog.getCategories', 'getCategories'),  
  • zqlib/tangle/limodou/blog/trunk/blog/apps/woodlog/api/metaweblogapi.py

    r925 r957  
    8 8  
    9 9 import os  
    10   import re  
    11 10 import xmlrpclib  
    12 11 import datetime  
      12 import time  
    13 13  
    14 14 from django.contrib.auth.models import User  
    15   from blog.woodlog.models import Category, Post  
      15 from apps.woodlog.models import Category, Entry  
    15 15 from django.db.models import ObjectDoesNotExist  
    16 16  
      17 def convert_time(t):  
      18     return datetime.datetime.fromtimestamp(time.mktime(time.strptime(str(t)[:17], '%Y%m%dT%H:%M:%S')))  
      19  
    17 20 def authenticated(func):  
    18 21     """  
     
    42 45 #   if struct.has_key('dateCreated'):  
    43 46 #       mtime = time.mktime(time.strptime(struct['dateCreated'], '%Y%m%dT%H:%M:%S'))  
    44       post = Post(title=struct['title'], body=struct['description'], pubdate=datetime.datetime.now())  
      47     post = Entry(title=struct['title'], body=struct['description'],  
      48         pubdate=convert_time(struct['dateCreated']), ispublic=publish, user=user,  
      49         outputformat=user.userprofile.rpc_text_format)  
    45 50     post.save()  
    46 51     for c in categories:  
     
    50 55 newPost = authenticated(newPost)  
    51 56  
      57 def editPost(user, blogid, struct, publish):  
      58     """  
      59     Add a new posting. Actually this is a faked posting, as the posting  
      60     is just used to decide what folder to move the referenced image to.  
      61     """  
      62     folder = struct.get('categories',[''])  
      63     categories = Category.objects.filter(name__in=struct.get('categories',['']))  
      64     post = Entry.objects.get(pk=int(blogid))  
      65 #   if struct.has_key('dateCreated'):  
      66 #       mtime = time.mktime(time.strptime(struct['dateCreated'], '%Y%m%dT%H:%M:%S'))  
      67     post.title = struct['title']  
      68     post.body = struct['description']  
      69     post.pubdate = convert_time(struct['dateCreated'])  
      70     post.ispublic = publish  
      71     post.outputformat = user.userprofile.rpc_text_format  
      72     post.save()  
      73     post.categories.clear()  
      74     for c in categories:  
      75         post.categories.add(c)  
      76     return post.id  
      77  
      78 editPost = authenticated(editPost)  
      79  
      80  
    52 81 def getCategories(user, blogid):  
    53 82     """  
     
    59 88      
    60 89     for o in objs:  
    61           categories.append({'title':o.name, 'description':o.description})  
      90         categories.append({'title':o.name, 'description':o.name})  
    61 90     return categories  
    62 91  
     
    69 98         postid = int(postid)  
    70 99     try:  
    71           post = Post.objects.get(pk=postid)  
      100         post = Entry.objects.get(pk=postid)  
    71 100     except ObjectDoesNotExist:  
    72 101         raise ValueError("Post is not existed")  
    89 118     if isinstance(number, str):  
    90 119         number = int(number)  
    91       objs = Post.objects.all()[:number]  
      120     objs = Entry.objects.all()[:number]  
    91 120     s = []  
    92 121     for obj in objs:  
  • zqlib/tangle/limodou/blog/trunk/blog/urls.py

    r951 r957  
    14 14      
    15 15     (r'^setting/', include('apps.profile.urls')),  
    16       (r'^RPC/', 'woodlog.rpc.call'),  
      16     (r'^RPC/', 'apps.woodlog.rpc.call'),  
    16 16     (r'^medias/(?P<path>.*)$', 'django.views.static.serve', media_dict),  
    17 17      
  • zqlib/tangle/limodou/blog/trunk/blog/rpcs.py

    r704 r957  
    2 2  
    3 3 rpccalls = dispatch('',  
    4       include('blog.woodlog.rpcs.metaweblog'),  
    5       include('blog.woodlog.rpcs.blogger'),  
    6       include('blog.woodlog.rpcs.moveabletype'),  
      4     include('apps.woodlog.rpcs.metaweblog'),  
      5     include('apps.woodlog.rpcs.blogger'),  
      6     include('apps.woodlog.rpcs.moveabletype'),  
    7 7 )  
    8 8