<commit_before>from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.db import Model as DBModel
from datetime import datetime


class BaseModel(db.Model):
    def __init__(self, parent=None, key_name=None, _app=None, **kwds):
        self.__isdirty = False
        DBModel.__init__(self, parent=None, key_name=None, _app=None, **kwds)
    
    def __setattr__(self,attrname,value):
        """
        DataStore api stores all prop values say "email" is stored in "_email" so
        we intercept the set attribute, see if it has changed, then check for an
        onchanged method for that property to call
        """
        if (attrname.find('_') != 0):
            if hasattr(self,'_' + attrname):
                curval = getattr(self,'_' + attrname)
                if curval != value:
                    self.__isdirty = True
                    if hasattr(self,attrname + '_onchange'):
                        getattr(self,attrname + '_onchange')(curval,value)
        
        DBModel.__setattr__(self,attrname,value)

class Cache(db.Model):
    cachekey = db.StringProperty(multiline=False)
    content = db.TextProperty()

class Blog(db.Model):
    owner = db.UserProperty()
    description = db.TextProperty()
    baseurl = db.StringProperty(multiline=False,default='http://yourapp.appspot.com')
    urlpath = db.StringProperty(multiline=False)
    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')
    area1 = db.TextProperty(default='')
    area2 = db.TextProperty(default='')
    area3 = db.TextProperty(default='')
    sidebar = db.TextProperty(default='')
    topmenu = db.StringProperty(multiline=True,default='')
    archivehtml = db.TextProperty(default='')
    tags = db.TextProperty(default='{}')
    analyticsjs = db.StringProperty(multiline=True,default='')
    commentjs = db.StringProperty(multiline=True,default='')
    
    def save(self):
        self.put()
    
    def initialsetup(self):
        self.title = 'Your Blog Title'
        self.subtitle = 'Your Blog Subtitle'
        self.area1 = '<h3>Lower Left Title</h3>\nContent in lower left'
        self.area2 = '<h3>Center Bottom Box</h3>\nContent in center footer'
        self.area3 = '<h3>Right Footer</h3>\nContent in footer right'
    

class Archive(db.Model):
    blog = db.ReferenceProperty(Blog)
    monthyear = db.StringProperty(multiline=False)
    """March-08"""
    entrycount = db.IntegerProperty(default=0)
    date = db.DateTimeProperty(auto_now_add=True)

class Tag(db.Model):
    blog = db.ReferenceProperty(Blog)
    tag = db.StringProperty(multiline=False)
    tagcount = db.IntegerProperty(default=0)

class Link(db.Model):
    blog = db.ReferenceProperty(Blog)
    href = db.StringProperty(multiline=False,default='')
    linktype = db.StringProperty(multiline=False,default='blogroll')
    linktext = db.StringProperty(multiline=False,default='')
<commit_msg>converting field from string to text, bug cant hold enough comment js<commit_after>from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext.db import Model as DBModel
from datetime import datetime


class BaseModel(db.Model):
    def __init__(self, parent=None, key_name=None, _app=None, **kwds):
        self.__isdirty = False
        DBModel.__init__(self, parent=None, key_name=None, _app=None, **kwds)
    
    def __setattr__(self,attrname,value):
        """
        DataStore api stores all prop values say "email" is stored in "_email" so
        we intercept the set attribute, see if it has changed, then check for an
        onchanged method for that property to call
        """
        if (attrname.find('_') != 0):
            if hasattr(self,'_' + attrname):
                curval = getattr(self,'_' + attrname)
                if curval != value:
                    self.__isdirty = True
                    if hasattr(self,attrname + '_onchange'):
                        getattr(self,attrname + '_onchange')(curval,value)
        
        DBModel.__setattr__(self,attrname,value)

class Cache(db.Model):
    cachekey = db.StringProperty(multiline=False)
    content = db.TextProperty()

class Blog(db.Model):
    owner = db.UserProperty()
    description = db.TextProperty()
    baseurl = db.StringProperty(multiline=False,default='http://yourapp.appspot.com')
    urlpath = db.StringProperty(multiline=False)
    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')
    area1 = db.TextProperty(default='')
    area2 = db.TextProperty(default='')
    area3 = db.TextProperty(default='')
    sidebar = db.TextProperty(default='')
    topmenu = db.StringProperty(multiline=True,default='')
    archivehtml = db.TextProperty(default='')
    tags = db.TextProperty(default='{}')
    analyticsjs = db.StringProperty(multiline=True,default='')
    commentjs = db.TextProperty(default='')
    
    def save(self):
        self.put()
    
    def initialsetup(self):
        self.title = 'Your Blog Title'
        self.subtitle = 'Your Blog Subtitle'
        self.area1 = '<h3>Lower Left Title</h3>\nContent in lower left'
        self.area2 = '<h3>Center Bottom Box</h3>\nContent in center footer'
        self.area3 = '<h3>Right Footer</h3>\nContent in footer right'
    

class Archive(db.Model):
    blog = db.ReferenceProperty(Blog)
    monthyear = db.StringProperty(multiline=False)
    """March-08"""
    entrycount = db.IntegerProperty(default=0)
    date = db.DateTimeProperty(auto_now_add=True)

class Tag(db.Model):
    blog = db.ReferenceProperty(Blog)
    tag = db.StringProperty(multiline=False)
    tagcount = db.IntegerProperty(default=0)

class Link(db.Model):
    blog = db.ReferenceProperty(Blog)
    href = db.StringProperty(multiline=False,default='')
    linktype = db.StringProperty(multiline=False,default='blogroll')
    linktext = db.StringProperty(multiline=False,default='')

{'fraction_non_alphanumeric': 0.12501903456677327, 'fraction_numerical': 0.00791837977767626, 'mean_word_length': 3.4199192462987886, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4748231', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1980, 'n_words': 411}