<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,7 +2,8 @@ import cgi, os
 from functools import wraps
 import wsgiref.handlers
 
-from google.appengine.ext.webapp import template
+from google.appengine.ext.webapp import template, \
+    WSGIApplication
 from google.appengine.api import users
 import webapp as webapp2
 from google.appengine.ext import webapp
@@ -44,6 +45,7 @@ class BaseController(webapp2.RequestHandler):
     def __init__(self):
         self.template = 'index.html'
         self.blog = Blog.all().fetch(1)
+        #self.app_version = WSGIApplication.active_instance
         if self.blog == []:
             pass
         else:
@@ -115,7 +117,7 @@ class PublicPage(BasePublicPage):
 class ArchivePage(BasePublicPage):
     def get(self,monthyear=None):
         entries = Entry.all().filter('monthyear', monthyear).\
-            filter(&quot;published =&quot;, True).order('-date')
+            filter(&quot;published =&quot;, True).filter('entrytype','post').order('-date')
         self.render('views/index.html',{'entries':entries})
     
 
@@ -215,12 +217,28 @@ class AdminList(BaseController):
     @requires_admin
     def get(self,entrytype='post',template_vals={}):
         entries = Entry.all().filter('entrytype =',entrytype).order('-date')
-        archive = Archive.all()
-        #for a in archive:
-        #    a.delete()
         self.render('views/admin.html',{'entries':entries})
     
 
+class AdminMigrate(BaseController):
+    @requires_admin
+    def get(self,to_version='1.15'):
+        if to_version == '1.16':
+            archives = Archive.all()
+            for a in archives:
+                a.delete()
+            entries = Entry.all().filter('entrytype =','post')
+            for e in entries:
+                e.update_archive()
+                e.monthyear = e.date.strftime('%b-%Y')
+                e.put()
+                print 'update to %s' % (e.monthyear)
+            archive = Archive.all()
+            self.blog.blogversion = to_version
+            self.blog.put()
+    
+
+
 class AdminLinks(BaseController):
     @requires_admin
     def get(self,linktype='blogroll'):
@@ -251,7 +269,7 @@ def main():
                      ('/admin/entry/(.*)', AdminEntry),
                      ('/admin/links/(.*)', AdminLinks),
                      ('/admin/setup', AdminConfig),
-                     ('/admin/migrate', AdminMigrate),
+                     ('/admin/migrate/(.*)', AdminMigrate),
                      ('/tag/(.*)', TagPage),
                      ('/atom', FeedHandler),
                      (r'/page/(.*)', PublicPage),</diff>
      <filename>blog.py</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,7 @@ class Blog(db.Model):
     title = db.StringProperty(multiline=False)
     subtitle = db.StringProperty(multiline=False)
     entrycount = db.IntegerProperty(default=0)
+    blogversion = db.StringProperty(multiline=False,default='1.15')
     layout = db.StringProperty(multiline=False,default='2cola',choices=[
         '3cola', '3colb', '2cola','2colb'])
     theme = db.StringProperty(multiline=False,default='freshpress.css')
@@ -79,6 +80,21 @@ class Entry(db.Model):
     
     tagswcommas = property(get_tags,set_tags)
     
+    def update_archive(self):
+        &quot;&quot;&quot;Checks to see if there is a month-year entry for the
+        month of current blog, if not creates it and increments count&quot;&quot;&quot;
+        my = datetime.now().strftime('%b-%Y') # May-2008
+        archive = Archive.all().filter('monthyear',my).fetch(10)
+        if archive == []:
+            archive = Archive(blog=self.blog,monthyear=my)
+            self.monthyear = my
+            archive.put()
+        else:
+            # ratchet up the count
+            archive[0].entrycount += 1
+            archive[0].put()
+        
+    
     def save(self):
         &quot;&quot;&quot;
         Use this instead of self.put(), as we do some other work here
@@ -89,16 +105,8 @@ class Entry(db.Model):
         if not self.is_saved():
             self.blog.entrycount += 1
             self.blog.save()
-            my = datetime.now().strftime('%b-%Y')
-            archive = Archive.all().filter('monthyear',my).fetch(10)
-            if archive == []:
-                archive = Archive(blog=self.blog,monthyear=my)
-                self.monthyear = my
-                archive.put()
-            else:
-                # ratchet up the count
-                archive[0].entrycount += 1
-                archive[0].put()
+            
+            self.update_archive()
         #b = self.blog
         #print b.tags
         #for tag in self.tagsnew:</diff>
      <filename>model.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c5d3e3a87d345535e639be89bdec340ebfccb8ab</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Raddon</name>
    <email>aeraddon@Macintosh-6.apollogrp.edu</email>
  </author>
  <url>http://github.com/araddon/potlatchblog/commit/cbd2b3abb58e9b0798bd6838f26a1a90554ce4d9</url>
  <id>cbd2b3abb58e9b0798bd6838f26a1a90554ce4d9</id>
  <committed-date>2008-05-13T10:27:51-07:00</committed-date>
  <authored-date>2008-05-13T10:27:51-07:00</authored-date>
  <message>fleshed out a migration tool for new features, implemented for archive feature</message>
  <tree>6fb7cd7a35d40b1bc75c4feefb67477d251b82e7</tree>
  <committer>
    <name>Aaron Raddon</name>
    <email>aeraddon@Macintosh-6.apollogrp.edu</email>
  </committer>
</commit>
