Ejemplo n.º 1
0
def get_tags(names = None, ids = None):
	where = Filter(None)
	if names is not None:
		where = Filter("name in ('%s')" % "','".join(names))

	if type(ids) == str:
		ids = [ str(int(x)) for x in ids.split(',') ]

	if ids is not None:
		where = Filter("tag in (%s)" % ','.join(ids))

	query = Select(
			fields = Fields([ 'tag', 'name' ]),
			source = Tables('Tags'),
			filter = where,
			order = Order('name'))

	results = query.execute(cursor())

	return [ (i.tag, i.name) for i in results ]
Ejemplo n.º 2
0
def recent(tags = []):
	query = Select(
			filter = Filter.recent() & Filter.tags(tags),
			order = Order.start_date(reverse = True))
	return query.execute(cursor())
Ejemplo n.º 3
0
def upcoming(tags = []):
	query = Select(
			filter = Filter.upcoming() & Filter.tags(tags),
			order = Order.start_date())
	return query.execute(cursor())
Ejemplo n.º 4
0
def deadlines(tags = []):
	query = Select(
			filter = Filter.upcomingDeadlines() & Filter.tags(tags),
			order = Order.deadline())
	return query.execute(cursor())