#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
    demeter web page
    name:origin.py
    author:rabin
"""
from __load__ import *

class view_path(Load):
	@Web.setting
	def get(self):
		id = self.input('id')
		if not id:
			self.out('error')
			return
		self.data['info'] = self.service('common').one('web_article', id=id)
		self.view("view.html")

class index_path(Load):
	@Web.setting
	def get(self):
		search = {}
		search['category_id'] = 2
		self.data['list'] = self.service('common').list('web_article', search=search, page={'num':10})
		if self.data['list']:
			for key, value in enumerate(self.data['list']):
				self.data['list'][key]['link'] = '/article/view?id=' + str(value['id'])

		self.view("list.html")