app/soc/views/site/home.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Tue, 19 Aug 2008 17:57:58 +0000
changeset 79 58001ec7720c
child 81 b03b1ec17727
permissions -rw-r--r--
Home site templates and basic view. Patch by: Pawel Solyga Review by: Todd Larsen Review issue: 385 Review URL: http://codereviews.googleopensourceprograms.com/385
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
79
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
#
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
#
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
#
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
#
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    17
"""Melange home page
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
"""
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
__authors__ = [
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    21
  '"Pawel Solyga" <pawel.solyga@gmail.com>',
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
  ]
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    24
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    25
from google.appengine.api import users
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    26
from django import http
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    27
from django import shortcuts
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    28
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    29
def public(request, template='soc/site/home.html'):
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
  """Home site view of Melange.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    31
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    32
  Args:
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    33
    request: the standard django request object.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    34
    template: the template path to use for rendering the template.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
  Returns:
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    37
    A subclass of django.http.HttpResponse with generated template.
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    38
  """
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
	
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    40
  user = users.get_current_user()
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    41
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    42
  return shortcuts.render_to_response(
58001ec7720c Home site templates and basic view.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    43
      template, dictionary={'template': template, 'user': user})