old_contents: # -*- coding: utf-8 -*-
  
  # Copyright (c) 2014 Vincent Celis
  # 
  # Permission is hereby granted, free of charge, to any person obtaining a copy
  # of this software and associated documentation files (the "Software"), to deal
  # in the Software without restriction, including without limitation the rights
  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  # copies of the Software, and to permit persons to whom the Software is
  # furnished to do so, subject to the following conditions:
  # 
  # The above copyright notice and this permission notice shall be included in
  # all copies or substantial portions of the Software.
  # 
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  # THE SOFTWARE.
  
  import logging
  
  import utils
  import settings
  
  from base import BaseHandler
  from models import Page
  
  class PageApi(BaseHandler):
    def get(self, name):
      name = utils.checkPage(name)
      version = self.checkVersionRequest()
  
      page = Page.getName(name, version)
  
      if page:
        self.renderJson(page.to_dict(exclude=['created']))
      else:
        self.abort(404)
  
  class HistoryApi(BaseHandler):
    def get(self, name):
      name = utils.checkPage(name)
  
      pages = Page.getNameAll(name)
      result = []
  
      for page in pages:
        result.append(page.to_dict(exclude=['created']))
      
      if result:
        self.renderJson(result)
      else:
        self.abort(404)
new_contents: # -*- coding: utf-8 -*-
  
  # Copyright (c) 2014 Vincent Celis
  # 
  # Permission is hereby granted, free of charge, to any person obtaining a copy
  # of this software and associated documentation files (the "Software"), to deal
  # in the Software without restriction, including without limitation the rights
  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  # copies of the Software, and to permit persons to whom the Software is
  # furnished to do so, subject to the following conditions:
  # 
  # The above copyright notice and this permission notice shall be included in
  # all copies or substantial portions of the Software.
  # 
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  # THE SOFTWARE.
  
  import logging
  
  import utils
  import settings
  
  from base import BaseHandler
  from models import Page
  
  class PageApi(BaseHandler):
    """API handler for specific wiki page versions
  
    API handler to handle the requests for the specific wiki page versions.
    Inherits common functionality from BaseHandler
    """
    def get(self, name):
      """Handles the get requests for the page API
  
      If a version is specified in the url it retreives the corresponding version
      of the requested page.
  
      If the requested version or page doesn't exist, a 404 will be served.    
      """
      name = utils.checkPage(name)
      version = self.checkVersionRequest()
  
      page = Page.getName(name, version)
  
      if page:
        self.renderJson(page.to_dict(exclude=['created', 'name']))
      else:
        self.abort(404)
  
  class HistoryApi(BaseHandler):
    """API handler for the history of wiki pages
  
    API handler to handle the requests for the history of the wiki pages.
  
    If the requested page doesn't exist, a 404 will be served.
    """
    def get(self, name):
      name = utils.checkPage(name)
  
      pages = Page.getNameAll(name)
      result = []
  
      for page in pages:
        result.append(page.to_dict(exclude=['created', 'name']))
      
      if result:
        self.renderJson(result)
      else:
        self.abort(404)
subject: update docstrings