コード例 #1
0
ファイル: model.py プロジェクト: cnripple/micolog
 def __init__(self,
              parent=None,
              key_name=None,
              _app=None,
              _from_entity=False,
              **kwds):
     from micolog_plugin import Plugins
     self.plugins = Plugins(self)
     db.Model.__init__(self, parent, key_name, _app, _from_entity, **kwds)
コード例 #2
0
ファイル: model.py プロジェクト: getfood/getfood-blog
 def __init__(self,
            parent=None,
            key_name=None,
            _app=None,
            _from_entity=False,
            **kwds):
     from micolog_plugin import Plugins
     self.plugins=Plugins(self)
     db.Model.__init__(self,parent,key_name,_app,_from_entity,**kwds)
コード例 #3
0
ファイル: model.py プロジェクト: getfood/getfood-blog
class Blog(db.Model):
    owner = db.UserProperty()
    author=db.StringProperty(default='admin')
    rpcuser=db.StringProperty(default='admin')
    rpcpassword=db.StringProperty(default='')
    description = db.TextProperty()
    baseurl = db.StringProperty(default=None)
    urlpath = db.StringProperty()
    title = db.StringProperty(default='Micolog')
    subtitle = db.StringProperty(default='This is a micro blog.')
    entrycount = db.IntegerProperty(default=0)
    posts_per_page= db.IntegerProperty(default=10)
    static_url = db.StringProperty(default='')
    feedurl = db.StringProperty(default='/feed')
    blogversion = db.StringProperty(default='0.30')
    theme_name = db.StringProperty(default='default')
    enable_memcache = db.BooleanProperty(default = False)
    link_format=db.StringProperty(default='%(year)s/%(month)s/%(day)s/%(postname)s.html')
    comment_notify_mail=db.BooleanProperty(default=True)
    #评论顺序
    comments_order=db.IntegerProperty(default=0)
    #每页评论数
    comments_per_page=db.IntegerProperty(default=20)
    #comment check type 0-No 1-算术 2-验证码 3-客户端计算
    comment_check_type=db.IntegerProperty(default=1)
    #0 default 1 identicon
    avatar_style=db.IntegerProperty(default=0)
    blognotice=db.TextProperty(default='')
    domain=db.StringProperty()
    show_excerpt=db.BooleanProperty(default=True)
    version=0.743
    timedelta=db.FloatProperty(default=8.0)# hours
    language=db.StringProperty(default="en-us")
    sitemap_entries=db.IntegerProperty(default=30)
    sitemap_include_category=db.BooleanProperty(default=False)
    sitemap_include_tag=db.BooleanProperty(default=False)
    sitemap_ping=db.BooleanProperty(default=False)
    default_link_format=db.StringProperty(default='?p=%(post_id)s')
    default_theme=Theme()
    allow_pingback=db.BooleanProperty(default=False)
    allow_trackback=db.BooleanProperty(default=False)
    admin_essential=db.BooleanProperty(default=False)
    theme=None
    admin_theme=AdminTheme()
    langs=None
    application=None

    def __init__(self,
               parent=None,
               key_name=None,
               _app=None,
               _from_entity=False,
               **kwds):
        from micolog_plugin import Plugins
        self.plugins=Plugins(self)
        db.Model.__init__(self,parent,key_name,_app,_from_entity,**kwds)

    def tigger_filter(self,name,content,*arg1,**arg2):
        return self.plugins.tigger_filter(name,content,blog=self,*arg1,**arg2)

    def tigger_action(self,name,*arg1,**arg2):
        return self.plugins.tigger_action(name,blog=self,*arg1,**arg2)

    def tigger_urlmap(self,url,*arg1,**arg2):
        return self.plugins.tigger_urlmap(url,blog=self,*arg1,**arg2)

    def get_ziplist(self):
        return self.plugins.get_ziplist();

    def save(self):
        self.put()

    def get_theme(self):
        self.theme= Theme(self.theme_name);
        return self.theme

    def get_langs(self):
        self.langs=LangIterator()
        return self.langs

    def cur_language(self):
        return self.get_langs().getlang(self.language)

    def rootpath(self):
        return rootpath

    @vcache("blog.hotposts")
    def hotposts(self):
        return Entry.all().filter('entrytype =','post').filter("published =", True).order('-readtimes').fetch(7)

    @vcache("blog.recentposts")
    def recentposts(self):
        return Entry.all().filter('entrytype =','post').filter("published =", True).order('-date').fetch(7)

    @vcache("blog.postscount")
    def postscount(self):
        return Entry.all().filter('entrytype =','post').filter("published =", True).order('-date').count()
コード例 #4
0
ファイル: model.py プロジェクト: cnripple/micolog
class Blog(db.Model):
    owner = db.UserProperty()
    author = db.StringProperty(default='admin')
    rpcuser = db.StringProperty(default='admin')
    rpcpassword = db.StringProperty(default='')
    description = db.TextProperty()
    baseurl = db.StringProperty(multiline=False, default=None)
    urlpath = db.StringProperty(multiline=False)
    title = db.StringProperty(multiline=False, default='Micolog')
    subtitle = db.StringProperty(multiline=False,
                                 default='This is a micro blog.')
    entrycount = db.IntegerProperty(default=0)
    posts_per_page = db.IntegerProperty(default=10)
    feedurl = db.StringProperty(multiline=False, default='/feed')
    blogversion = db.StringProperty(multiline=False, default='0.30')
    theme_name = db.StringProperty(multiline=False, default='default')
    enable_memcache = db.BooleanProperty(default=False)
    link_format = db.StringProperty(
        multiline=False,
        default='%(year)s/%(month)s/%(day)s/%(postname)s.html')
    comment_notify_mail = db.BooleanProperty(default=True)
    #评论顺序
    comments_order = db.IntegerProperty(default=0)
    #每页评论数
    comments_per_page = db.IntegerProperty(default=20)
    #comment check type 0-No 1-算术 2-验证码 3-客户端计算
    comment_check_type = db.IntegerProperty(default=1)
    #0 default 1 identicon
    avatar_style = db.IntegerProperty(default=0)

    blognotice = db.TextProperty(default='')

    domain = db.StringProperty()
    show_excerpt = db.BooleanProperty(default=True)
    version = 0.741
    timedelta = db.FloatProperty(default=8.0)  # hours
    language = db.StringProperty(default="en-us")

    sitemap_entries = db.IntegerProperty(default=30)
    sitemap_include_category = db.BooleanProperty(default=False)
    sitemap_include_tag = db.BooleanProperty(default=False)
    sitemap_ping = db.BooleanProperty(default=False)
    default_link_format = db.StringProperty(multiline=False,
                                            default='?p=%(post_id)s')
    default_theme = Theme("default")

    allow_pingback = db.BooleanProperty(default=False)
    allow_trackback = db.BooleanProperty(default=False)

    theme = None
    langs = None
    application = None

    def __init__(self,
                 parent=None,
                 key_name=None,
                 _app=None,
                 _from_entity=False,
                 **kwds):
        from micolog_plugin import Plugins
        self.plugins = Plugins(self)
        db.Model.__init__(self, parent, key_name, _app, _from_entity, **kwds)

    def tigger_filter(self, name, content, *arg1, **arg2):
        return self.plugins.tigger_filter(name,
                                          content,
                                          blog=self,
                                          *arg1,
                                          **arg2)

    def tigger_action(self, name, *arg1, **arg2):
        return self.plugins.tigger_action(name, blog=self, *arg1, **arg2)

    def tigger_urlmap(self, url, *arg1, **arg2):
        return self.plugins.tigger_urlmap(url, blog=self, *arg1, **arg2)

    def get_ziplist(self):
        return self.plugins.get_ziplist()

    def save(self):
        self.put()

    def initialsetup(self):
        self.title = 'Your Blog Title'
        self.subtitle = 'Your Blog Subtitle'

    def get_theme(self):
        self.theme = Theme(self.theme_name)
        return self.theme

    def get_langs(self):
        self.langs = LangIterator()
        return self.langs

    def cur_language(self):
        return self.get_langs().getlang(self.language)

    def rootpath(self):
        return rootpath

    @vcache("blog.hotposts")
    def hotposts(self):
        return Entry.all().filter('entrytype =', 'post').filter(
            "published =", True).order('-readtimes').fetch(8)

    @vcache("blog.recentposts")
    def recentposts(self):
        return Entry.all().filter('entrytype =',
                                  'post').filter("published =",
                                                 True).order('-date').fetch(8)

    @vcache("blog.postscount")
    def postscount(self):
        return Entry.all().filter('entrytype =',
                                  'post').filter("published =",
                                                 True).order('-date').count()