예제 #1
0
 def get(self):
     nt = 0
     log = []
     for tid in Tiddler.all().filter("current", True):
         if not (tid.tags is None):
             nt = nt + addTagLinks(tid, tagStringToList(tid.tags))
     self.response.out.write(str(nt) + " tags found..")
예제 #2
0
 def get(self):
     nt = 0
     log = []
     for tid in Tiddler.all().filter("current", True):
         if not (tid.tags is None):
             nt = nt + addTagLinks(tid, tagStringToList(tid.tags))
     self.response.out.write(str(nt) + " tags found..")
예제 #3
0
    def get(self):
        for cj in CronJob.all():
            if cj.when < datetime.datetime.now():
                tdlr = Tiddler.all().filter('id', cj.tiddler).filter(
                    'current', True).get()
                if tdlr is None:
                    logging.warning("Tiddler not found")
                else:
                    if cj.action == 'promote':
                        logging.info("CJob:promote " + cj.tiddler)
                        if hasattr(tdlr, 'deprecated'):
                            delattr(tdlr, 'deprecated')
                        tdlr.tags = tdlr.tags.replace('@promote@',
                                                      '@promoted@')
                        tdlr.put()
                        dts = Tiddler.all().filter('page', tdlr.page).filter(
                            'title',
                            'DefaultTiddlers').filter('current', True).get()
                        if dts is None:
                            logging.warning(
                                "DefaultTiddlers not found for page " +
                                tdlr.page)
                        else:
                            dtparts = dts.text.split('\n')
                            dtparts.insert(cj.position,
                                           '[[' + tdlr.title + ']]')
                            dts.text = '\n'.join(dtparts)
                            dts.put()
                            logging.info("Tiddler " + tdlr.title +
                                         " added to DefaultTiddlers")
                    if cj.action == 'announce':
                        logging.info("CJob/announce " + cj.tiddler)
                        if hasattr(tdlr, 'deprecated'):
                            delattr(tdlr, 'deprecated')
                        tdlr.tags = tdlr.tags.replace('@announce@',
                                                      '@announced@')
                        tdlr.put()
                        dts = Tiddler.all().filter('page', tdlr.page).filter(
                            'title', 'MainMenu').filter('current', True).get()
                        if dts is None:
                            logging.warning("MainMenu not found for page " +
                                            tdlr.page)
                        else:
                            dtparts = dts.text.split('\n')
                            dtparts.insert(cj.position,
                                           '[[' + tdlr.title + ']]')
                            dts.text = '\n'.join(dtparts)
                            dts.put()
                            logging.info("Tiddler " + tdlr.title +
                                         " added to MainMenu")
                    if cj.action == 'demote' or cj.action == 'deprecate':
                        logging.info("CJob:demote " + cj.tiddler)
                        dts = Tiddler.all().filter('page', tdlr.page).filter(
                            'title',
                            'DefaultTiddlers').filter('current', True).get()
                        if not dts is None:
                            ss = '[[' + tdlr.title + ']]\n'
                            dts.text = dts.text.replace(ss, '')
                            dts.put()
                        dts = Tiddler.all().filter('page', tdlr.page).filter(
                            'title', 'MainMenu').filter('current', True).get()
                        if not dts is None:
                            ss = '[[' + tdlr.title + ']]\n'
                            dts.text = dts.text.replace(ss, '')
                            dts.put()
                    if cj.action == 'deprecate':
                        logging.info("CJob:deprecate " + cj.tiddler)
                        setattr(tdlr, 'deprecated', True)
                        tdlr.put()
                    if cj.action == 'revert':
                        logging.info("CJob: revert " + str(cj.tiddler) +
                                     " to V#" + str(cj.position))
                        rvn = cj.position if cj.position > 0 else tdlr.version - 1
                        tdlrvr = Tiddler.all().filter('id', cj.tiddler).filter(
                            'version', rvn).get()
                        if tdlrvr is None:
                            logging.warning("Version " + str(rvn) +
                                            " of tiddler " + tdlr.page + "#" +
                                            tdlr.title + " not found!")
                        else:
                            tdlr.current = False
                            tdlr.put()
                            tdlrvr.current = True
                            tdlrvr.vercnt = tdlr.vercnt
                            tdlrvr.reverted = datetime.datetime.now()
                            tdlrvr.reverted_by = None
                            tdlrvr.put()

                cj.delete()
예제 #4
0
  def get(self):
	for cj in CronJob.all():
		if cj.when < datetime.datetime.now():
			tdlr = Tiddler.all().filter('id',cj.tiddler).filter('current',True).get()
			if tdlr is None:
				logging.warning("Tiddler not found")
			else:
				if cj.action == 'promote':
					logging.info("CJob:promote " + cj.tiddler)
					if hasattr(tdlr,'deprecated'):
						delattr(tdlr,'deprecated')
					tdlr.tags = tdlr.tags.replace('@promote@','@promoted@')
					tdlr.put()
					dts = Tiddler.all().filter('page', tdlr.page).filter('title','DefaultTiddlers').filter('current', True).get()
					if dts is None:
						logging.warning("DefaultTiddlers not found for page " + tdlr.page)
					else:
						dtparts = dts.text.split('\n')
						dtparts.insert(cj.position,'[[' + tdlr.title + ']]')
						dts.text = '\n'.join(dtparts)
						dts.put()
						logging.info("Tiddler " + tdlr.title + " added to DefaultTiddlers") 
				if cj.action == 'announce':
					logging.info("CJob/announce " + cj.tiddler)
					if hasattr(tdlr,'deprecated'):
						delattr(tdlr,'deprecated')
					tdlr.tags = tdlr.tags.replace('@announce@','@announced@')
					tdlr.put()
					dts = Tiddler.all().filter('page', tdlr.page).filter('title','MainMenu').filter('current', True).get()
					if dts is None:
						logging.warning("MainMenu not found for page " + tdlr.page)
					else:
						dtparts = dts.text.split('\n')
						dtparts.insert(cj.position,'[[' + tdlr.title + ']]')
						dts.text = '\n'.join(dtparts)
						dts.put()
						logging.info("Tiddler " + tdlr.title + " added to MainMenu") 
				if cj.action == 'demote' or cj.action == 'deprecate':
					logging.info("CJob:demote " + cj.tiddler)
					dts = Tiddler.all().filter('page', tdlr.page).filter('title','DefaultTiddlers').filter('current', True).get()
					if not dts is None:
						ss = '[[' + tdlr.title + ']]\n'
						dts.text = dts.text.replace(ss,'')
						dts.put()
					dts = Tiddler.all().filter('page', tdlr.page).filter('title','MainMenu').filter('current', True).get()
					if not dts is None:
						ss = '[[' + tdlr.title + ']]\n'
						dts.text = dts.text.replace(ss,'')
						dts.put()
				if cj.action == 'deprecate':
					logging.info("CJob:deprecate " + cj.tiddler)
					setattr(tdlr,'deprecated',True)
					tdlr.put()
				if cj.action == 'revert':
					logging.info("CJob: revert " + str(cj.tiddler) + " to V#" + str(cj.position))
					rvn = cj.position if cj.position > 0 else tdlr.version - 1
					tdlrvr = Tiddler.all().filter('id',cj.tiddler).filter('version',rvn).get()
					if tdlrvr is None:
						logging.warning("Version " + str(rvn) + " of tiddler " + tdlr.page + "#" + tdlr.title + " not found!")
					else:
						tdlr.current = False
						tdlr.put()
						tdlrvr.current = True
						tdlrvr.vercnt = tdlr.vercnt
						tdlrvr.reverted = datetime.datetime.now()
						tdlrvr.reverted_by = None
						tdlrvr.put()

			cj.delete()