blob: 076c99a2f9a90f98148bdff669d9378388daa4bd [file] [log] [blame]
# Copyright 2014 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Module for managing Code In-specific URL generation."""
from django.core import urlresolvers
from melange.request import links
class CILinker(links.Linker):
"""URL creator for Code In."""
def taskReminder(self, task_key, reminder_type, url_name):
"""Returns the URL of a task reminder's named page.
Args:
task: db.Key of task entity.
reminder_type: task_reminder_logic.ReminderType of the reminder.
url_name: The name with which a URL was registered with Django.
Returns:
The URL of the page matching the given name for the given survey.
"""
kwargs = {
'reminder_id': reminder_type.value,
'task_id': task_key.id(),
}
return urlresolvers.reverse(url_name, kwargs=kwargs)
# Since Linker is stateless, there might as well be just one of it.
CI_LINKER = CILinker()