3043
+ − 1
# Copyright 2009 the Melange authors.
+ − 2
#
+ − 3
# Licensed under the Apache License, Version 2.0 (the "License");
+ − 4
# you may not use this file except in compliance with the License.
+ − 5
# You may obtain a copy of the License at
+ − 6
#
+ − 7
# http://www.apache.org/licenses/LICENSE-2.0
+ − 8
#
+ − 9
# Unless required by applicable law or agreed to in writing, software
+ − 10
# distributed under the License is distributed on an "AS IS" BASIS,
+ − 11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ − 12
# See the License for the specific language governing permissions and
+ − 13
# limitations under the License.
+ − 14
+ − 15
"""Module containing the GSoC Callback.
+ − 16
"""
+ − 17
+ − 18
__authors__ = [
+ − 19
'"Sverre Rabbelier" <sverre@rabbelier.nl>',
+ − 20
]
+ − 21
+ − 22
from soc.modules.gsoc.views.models import mentor
+ − 23
from soc.modules.gsoc.views.models import org_admin
+ − 24
from soc.modules.gsoc.views.models import organization
+ − 25
from soc.modules.gsoc.views.models import program
+ − 26
from soc.modules.gsoc.views.models import student
+ − 27
from soc.modules.gsoc.views.models import timeline
+ − 28
+ − 29
+ − 30
class Callback(object):
+ − 31
"""Callback object that handles interaction between the core.
+ − 32
"""
+ − 33
+ − 34
API_VERSION = 1
+ − 35
+ − 36
def __init__(self, core):
+ − 37
"""Initializes a new Callback object for the specified core.
+ − 38
"""
+ − 39
+ − 40
self.core = core
+ − 41
+ − 42
def registerWithSitemap(self):
+ − 43
"""Called by the server when sitemap entries should be registered.
+ − 44
"""
+ − 45
+ − 46
self.core.requireUniqueService('registerWithSitemap')
+ − 47
+ − 48
# register the GSoC Views
+ − 49
self.core.registerSitemapEntry(mentor.view.getDjangoURLPatterns())
+ − 50
self.core.registerSitemapEntry(org_admin.view.getDjangoURLPatterns())
+ − 51
self.core.registerSitemapEntry(organization.view.getDjangoURLPatterns())
+ − 52
self.core.registerSitemapEntry(program.view.getDjangoURLPatterns())
+ − 53
self.core.registerSitemapEntry(student.view.getDjangoURLPatterns())
+ − 54
self.core.registerSitemapEntry(timeline.view.getDjangoURLPatterns())
+ − 55
+ − 56
def registerWithSidebar(self):
+ − 57
"""Called by the server when sidebar entries should be registered.
+ − 58
"""
+ − 59
+ − 60
# require that we had the chance to register the urls we need with the sitemap
+ − 61
self.core.requireUniqueService('registerWithSidebar')
+ − 62
+ − 63
# register the GHOP menu entries
+ − 64
self.core.registerSidebarEntry(mentor.view.getSidebarMenus)
+ − 65
self.core.registerSidebarEntry(org_admin.view.getSidebarMenus)
+ − 66
self.core.registerSidebarEntry(organization.view.getSidebarMenus)
+ − 67
self.core.registerSidebarEntry(program.view.getSidebarMenus)
+ − 68
self.core.registerSidebarEntry(student.view.getSidebarMenus)
+ − 69
self.core.registerSidebarEntry(timeline.view.getSidebarMenus)