# -*- coding: utf-8 -*-
hooks = {
    'newproject': [],        # (site)
    'generate': [],          # (site, dir, quiet)
    'publish': [],           # (site, s3)
    'install': [],           # (site, project)
    'preview': [],           # (site)
    'server_start': [],
    'server_stop': [],
}


class register_hook(object):
    """Register hook with @register_hook("EVENT") where EVENT is "newproject" etc"""
    def __init__(self, event):
        self.event = event

    def __call__(self, f):
        # Avoid weird duplication
        names = ['{0}.{1}'.format(func.__module__, func.func_name) for func in hooks[self.event]]
        if '{0}.{1}'.format(f.__module__, f.func_name) not in names:
            hooks[self.event].append(f)
        return f

@@ -265,16 +265,30 @@
 rt': %5B%5D,
+      # (site)
 %0A    'se
@@ -302,16 +302,31 @@
 op': %5B%5D,
+       # (site)
 %0A%7D%0A%0A%0Acla

add comment to hooks