# Path: floyd/controllers/controllers.py
# class BaseController(object):
# def index():
# def TemplateVars(vars):
# def RenderPosts(posts, outputdir):  
# def post(post, route):
# def page(post, route):
# def index():
# def archive():
# def feed():
# def render(template_name, template_path, template_variables, output_file):
# 
# Path: floyd/core/multiopt.py
# class CommandError(Exception): pass


import os
import sys
import floyd.db
import floyd.templating.jinja
from floyd.controllers import controllers
from floyd.core.multiopt import CommandError
  from floyd.core.server import Server, ThreadedHTTPServer, StaticRequestHandler

On a command error throw CommandError with a detailed description. This will refer
the user to the help page

"""





_DEFAULT_ROUTES = [
  ('/', 'controllers.index'),
  ('/archive', 'controllers.archive'),
  ('/<stub>', 'controllers.page'),
  ('/posts/<stub>', 'controllers.post')
]

_DEFAULT_GENERATOR = [
  # (post.stub in floyd.db.Query('Posts').filter(post_type='post').filter(post_status='published').fetch(100))
  # map(post, posts)
  # or list expression
  # [controllers.post(p, '/posts/<stub>') for p in posts]
]
# @TODO this can be a lot better
# _TITLE_MATCH = re.compile('<h1 id="title">(.*)</h1>')


def init(options, init_type=None, path='.'):
  valid_inits = ['static', 'gae', 's3']
  if not init_type in valid_inits:

# Path: floyd/controllers/controllers.py
# class BaseController(object):
# def index():
# def TemplateVars(vars):
# def RenderPosts(posts, outputdir):  
# def post(post, route):
# def page(post, route):
# def index():
# def archive():
# def feed():
# def render(template_name, template_path, template_variables, output_file):
# 
# Path: floyd/core/multiopt.py
# class CommandError(Exception): pass


# Path: floyd/core/commands.py
import os
import sys
import floyd.db
import floyd.templating.jinja
from floyd.controllers import controllers
from floyd.core.multiopt import CommandError
  from floyd.core.server import Server, ThreadedHTTPServer, StaticRequestHandler


On a command error throw CommandError with a detailed description. This will refer
the user to the help page

"""





_DEFAULT_ROUTES = [
  ('/', 'controllers.index'),
  ('/archive', 'controllers.archive'),
  ('/<stub>', 'controllers.page'),
  ('/posts/<stub>', 'controllers.post')
]

_DEFAULT_GENERATOR = [
  # (post.stub in floyd.db.Query('Posts').filter(post_type='post').filter(post_status='published').fetch(100))
  # map(post, posts)
  # or list expression
  # [controllers.post(p, '/posts/<stub>') for p in posts]
]
# @TODO this can be a lot better
# _TITLE_MATCH = re.compile('<h1 id="title">(.*)</h1>')


def init(options, init_type=None, path='.'):
  valid_inits = ['static', 'gae', 's3']
  if not init_type in valid_inits:

    raise CommandError("Type must be one of %s" % (", ".join(valid_inits)))