# Path: apps/page/models.py
# class Page(models.Model):
# 
#     team        = models.ForeignKey("team.Team", related_name="pages")
#     link        = models.SlugField(unique=True)
#     name        = models.CharField(max_length=1024)
#     content     = SanitizedCharField(
#                     max_length=50000, allowed_tags=SANITIZER_ALLOWED_TAGS, 
#                     allowed_attributes=SANITIZER_ALLOWED_ATTRIBUTES, strip=False
#                 )
# 
#     order       = models.IntegerField(blank=True, null=True)
# 
#     # meta
#     created_by  = models.ForeignKey(Account, related_name="pages_created")
#     created_on  = models.DateTimeField(auto_now_add=True)
#     updated_by  = models.ForeignKey(Account, related_name="pages_updated")
#     updated_on  = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return u"%s: %s" % (self.team.name, self.name)
# 
#     class Meta:                                                                                                 
#                                                                                                                 
#         unique_together = (("team", "name"), ("team", "link")) 
#         ordering = ["order", "name"]
# 
# Path: apps/team/control.py
# def get_team_emails(team, excludes=None):
# def get_teams(account):
# def get_or_404(link):
# def is_member(account, team):
# def create(account, name, country, logo, application):
# def notify_staff_team_created(sender, **kwargs):
# def notify_team_join_request_created(sender, **kwargs):
# def notify_team_join_request_processed(sender, **kwargs):
# def notify_concerned_remove_request_created(sender, **kwargs):
# def notify_team_remove_request_created(sender, **kwargs):
# def notify_team_remove_request_processed(sender, **kwargs):
# def can_replace_logo(account, team):
# def replace_logo(account, team, logo):
# def can_join(account, team):
# def create_join_request(account, team, application):
# def can_process_join_request(account, join_request):
# def process_join_request(account, join_request, response, status):
# def has_remove_request(concerned, team):
# def can_create_remove_request(requester, concerned, team):
# def can_process_remove_request(account, remove_request):
# def create_remove_request(requester, concerned, team, reason):
# def process_remove_request(account, remove_request, response, status):
# def site_link_exists(team, site):
# def can_create_link(account, team, site, profile):
# def can_delete_link(account, team, link):
# def link_create(account, team, site, profile):
# def link_delete(account, team, link):


from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
from apps.common.shortcuts import render_response
from apps.page.models import Page
from apps.common.shortcuts import get_object_or_none
from apps.team import control
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




ENTRIE_NAMES = {
    "blog" : _("BLOG"),
    "bikes" : _("BIKES"),
    "members" : _("MEMBERS"),
    "borrows" : _("BORROWS"),
    "stations" : _("STATIONS"),
    "join_request/list" : _("JOIN_REQUESTS"),
    "remove_request/list" : _("REMOVE_REQUESTS"),
}



# Path: apps/page/models.py
# class Page(models.Model):
# 
#     team        = models.ForeignKey("team.Team", related_name="pages")
#     link        = models.SlugField(unique=True)
#     name        = models.CharField(max_length=1024)
#     content     = SanitizedCharField(
#                     max_length=50000, allowed_tags=SANITIZER_ALLOWED_TAGS, 
#                     allowed_attributes=SANITIZER_ALLOWED_ATTRIBUTES, strip=False
#                 )
# 
#     order       = models.IntegerField(blank=True, null=True)
# 
#     # meta
#     created_by  = models.ForeignKey(Account, related_name="pages_created")
#     created_on  = models.DateTimeField(auto_now_add=True)
#     updated_by  = models.ForeignKey(Account, related_name="pages_updated")
#     updated_on  = models.DateTimeField(auto_now=True)
# 
#     def __unicode__(self):
#         return u"%s: %s" % (self.team.name, self.name)
# 
#     class Meta:                                                                                                 
#                                                                                                                 
#         unique_together = (("team", "name"), ("team", "link")) 
#         ordering = ["order", "name"]
# 
# Path: apps/team/control.py
# def get_team_emails(team, excludes=None):
# def get_teams(account):
# def get_or_404(link):
# def is_member(account, team):
# def create(account, name, country, logo, application):
# def notify_staff_team_created(sender, **kwargs):
# def notify_team_join_request_created(sender, **kwargs):
# def notify_team_join_request_processed(sender, **kwargs):
# def notify_concerned_remove_request_created(sender, **kwargs):
# def notify_team_remove_request_created(sender, **kwargs):
# def notify_team_remove_request_processed(sender, **kwargs):
# def can_replace_logo(account, team):
# def replace_logo(account, team, logo):
# def can_join(account, team):
# def create_join_request(account, team, application):
# def can_process_join_request(account, join_request):
# def process_join_request(account, join_request, response, status):
# def has_remove_request(concerned, team):
# def can_create_remove_request(requester, concerned, team):
# def can_process_remove_request(account, remove_request):
# def create_remove_request(requester, concerned, team, reason):
# def process_remove_request(account, remove_request, response, status):
# def site_link_exists(team, site):
# def can_create_link(account, team, site, profile):
# def can_delete_link(account, team, link):
# def link_create(account, team, site, profile):
# def link_delete(account, team, link):


# Path: apps/team/utils.py
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
from apps.common.shortcuts import render_response
from apps.page.models import Page
from apps.common.shortcuts import get_object_or_none
from apps.team import control

# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>                  
# License: MIT (see LICENSE.TXT file) 




ENTRIE_NAMES = {
    "blog" : _("BLOG"),
    "bikes" : _("BIKES"),
    "members" : _("MEMBERS"),
    "borrows" : _("BORROWS"),
    "stations" : _("STATIONS"),
    "join_request/list" : _("JOIN_REQUESTS"),
    "remove_request/list" : _("REMOVE_REQUESTS"),
}



def assert_member(account, team):