Exemple #1
0
 def logger(self):
     if self._logger and self._logger.name == self.loggerName:
         return self._logger
     with _loggerLock:
         if self._logger and self._logger.name == self.loggerName:
             return self._logger
         from shimehari.logging import createLogger
         self._logger = rv = createLogger(self.loggerName)
         return rv
Exemple #2
0
 def logger(self):
     if self._logger and self._logger.name == self.loggerName:
         return self._logger
     with _loggerLock:
         if self._logger and self._logger.name == self.loggerName:
             return self._logger
         from shimehari.logging import createLogger
         self._logger = rv = createLogger(self.loggerName)
         return rv
Exemple #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from google.appengine.ext import db
from shimehari.logging import createLogger
from app.models.articles import ArticleModel
from app.models.sites import SystemInfoModel

logger = createLogger()


class TagModel(db.Model):
    tagname = db.StringProperty()
    article = db.ReferenceProperty(ArticleModel, collection_name='tags')
    created_at = db.DateTimeProperty(auto_now_add=True)

    def publish(self, name, article):
        self.tagname = name
        self.article = article
        self.put()
        return self

    def deleteModel(self):
        SystemInfoModel.decrementTagCount(self.tagname)
        self.delete()


def createTags(tags, article):
    tagList = tags.split(',')
    results = []
    for tag in tagList: