<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1 @@
-0.1
+0.2</diff>
      <filename>VERSION</filename>
    </modified>
    <modified>
      <diff>@@ -29,28 +29,20 @@ class DoubanAccount(db.Model):
         return new_account
 
     @classmethod
-    def get_authenticated_accounts(cls, user):
+    def get_authenticated_accounts(cls, user, douban_id=None):
         &quot;&quot;&quot; &#26174;&#31034;&#26368;&#36817;&#21019;&#24314;&#30340;&#24050;&#25480;&#26435;&#30340;&#24080;&#25143; &quot;&quot;&quot;
         query = cls.all() \
                    .filter('user = ', user) \
                    .filter('request_key = ', 'ALREADY_AUTHENTICATED') \
-                   .order('-created') \
-                   .fetch(settings.MAX_STORED_ACCOUNTS)
-        return query
+                   .order('-created')
+        if douban_id is None:
+            return query.fetch(settings.MAX_STORED_ACCOUNTS)
+        else:
+            return query.filter('douban_id = ', douban_id).get()
 
     def get_douban_profile(self):
-        &quot;&quot;&quot; &#33719;&#21462;&#30456;&#24212;&#30340;&#35910;&#29923;&#29992;&#25143;&#26723;&#26696;
-            &#22914;&#26524;&#36229;&#36807;&#20102;&#32531;&#23384;&#30340;&#26377;&#25928;&#26102;&#38480;&#65292;&#26356;&#26032;&#26723;&#26696;
-
-        &quot;&quot;&quot;
-        profile = DoubanProfile.get_by_douban_id(self.douban_id)
-        if profile.need_update():
-            service = douban_service()
-            # GData &#19981;&#22826;&#25903;&#25345; Unicode
-            entry = service.GetPeople('/people/%s' % \
-                                      self.douban_id.encode('utf-8'))
-            profile.update(entry)
-        return profile
+        &quot;&quot;&quot; &#33719;&#21462;&#30456;&#24212;&#30340;&#35910;&#29923;&#29992;&#25143;&#26723;&#26696; &quot;&quot;&quot;
+        return DoubanProfile.get_by_douban_id(self.douban_id)
     douban_profile = property(get_douban_profile)
 
     def set_request_key(self, key, secret):
@@ -110,8 +102,19 @@ class DoubanProfile(db.Model):
 
     @classmethod
     def get_by_douban_id(cls, douban_id):
-        &quot;&quot;&quot; &#25353;&#35910;&#29923; ID &#33719;&#21462;&#29992;&#25143;&#26723;&#26696; &quot;&quot;&quot;
-        return cls.all().filter('douban_id = ', douban_id).get()
+        &quot;&quot;&quot;
+        &#25353;&#35910;&#29923; ID &#33719;&#21462;&#29992;&#25143;&#26723;&#26696;
+        &#22914;&#26524;&#36229;&#36807;&#20102;&#32531;&#23384;&#30340;&#26377;&#25928;&#26102;&#38480;&#65292;&#26356;&#26032;&#26723;&#26696;
+
+        &quot;&quot;&quot;
+        profile = cls.all().filter('douban_id = ', douban_id).get()
+        if profile and profile.need_update():
+            service = douban_service()
+            # GData &#19981;&#22826;&#25903;&#25345; Unicode
+            entry = service.GetPeople('/people/%s' % \
+                                      douban_id.encode('utf-8'))
+            profile.update(entry)
+        return profile
 
     @classmethod
     def insert_or_update(cls, people_entry):</diff>
      <filename>authdouban/models.py</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,9 @@
 {% extends 'base.html' %}
 
-{% block delete_account %}
+{% block main %}
 &lt;div class=&quot;delete-account&quot;&gt;
 
+    {% if douban_account %}
     &lt;div class=&quot;title&quot;&gt;
         &lt;h3&gt;&#20320;&#30830;&#23450;&#35201;&#27880;&#38144;&#36825;&#20010;&#35910;&#29923;&#24080;&#21495;&#30340;&#25480;&#26435;&#21527;&#65311;&lt;/h3&gt;
     &lt;/div&gt;
@@ -19,5 +20,11 @@
             &lt;/div&gt;
         &lt;/form&gt;
     &lt;/div&gt;
+    {% else %}
+    &lt;div class=&quot;title last&quot;&gt;
+        &lt;h3&gt;&#27809;&#25214;&#21040;&#35910;&#29923; ID &#20026; {{ douban_id }} &#30340;&#24050;&#25480;&#26435;&#24080;&#25143;&lt;/h3&gt;
+    &lt;/div&gt;
+    {% endif %}
+
 &lt;/div&gt;
 {% endblock %}</diff>
      <filename>authdouban/templates/authdouban/delete_account.html</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@
         {% block douban_user_delete %}
         {% if douban_account %}
         &lt;div class=&quot;douban-user-delete&quot;&gt;
-            &lt;a href=&quot;/account/douban/delete/{{ douban_account.key }}/&quot; class=&quot;douban-user-delete&quot;&gt;&#21024;&#38500;&#24080;&#21495;&lt;/a&gt;
+            &lt;a href=&quot;/account/douban/delete/{{ douban_account.douban_id }}/&quot; class=&quot;douban-user-delete&quot;&gt;&#21024;&#38500;&#24080;&#21495;&lt;/a&gt;
         &lt;/div&gt;
         {% endif %}
         {% endblock %}</diff>
      <filename>authdouban/templates/authdouban/douban_user.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 {% extends 'base.html' %}
 
-{% block list_account %}
+{% block main %}
 &lt;div class=&quot;account-list&quot;&gt;
     {% if not douban_accounts %}
     &lt;div class=&quot;no-account&quot;&gt;</diff>
      <filename>authdouban/templates/authdouban/list_account.html</filename>
    </modified>
    <modified>
      <diff>@@ -96,12 +96,17 @@ class DeleteAccount(webapp.RequestHandler):
     &#21024;&#38500;&#24050;&#25480;&#26435;&#24080;&#25143;
 
     &quot;&quot;&quot;
-    def get(self, key, template_name='templates/authdouban/delete_account.html'):
+    def get(self, douban_id, template_name='templates/authdouban/delete_account.html'):
+        user = users.get_current_user()
+        account = DoubanAccount.get_authenticated_accounts(user, douban_id)
         context = {
-            'douban_account': DoubanAccount.get(key),
+            'douban_id': douban_id,
+            'douban_account': account,
         }
         return render_to_response(self, template_name, context)
 
-    def post(self, key):
-        DoubanAccount.get(key).delete()
+    def post(self, douban_id):
+        user = users.get_current_user()
+        account = DoubanAccount.get_authenticated_accounts(user, douban_id)
+        account.delete()
         return self.redirect('/account/douban/')</diff>
      <filename>authdouban/views.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a5df957e8778d3dfb3d69db060d3efd008683060</id>
    </parent>
  </parents>
  <author>
    <name>wu yuntao</name>
    <email>wyt.py@thonic.org</email>
  </author>
  <url>http://github.com/wuyuntao/appengine-authdouban/commit/44f373c8025bd8486dc5e6779fa9be3c1b6f3813</url>
  <id>44f373c8025bd8486dc5e6779fa9be3c1b6f3813</id>
  <committed-date>2009-03-03T04:23:54-08:00</committed-date>
  <authored-date>2009-03-03T04:23:54-08:00</authored-date>
  <message>Delete accounts by douban id instead of account key.</message>
  <tree>d6aba5a9b16c0e7501817c42e57e6c8fb3d24b0d</tree>
  <committer>
    <name>wu yuntao</name>
    <email>wyt.py@thonic.org</email>
  </committer>
</commit>
