View after
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile | |
... | |
[INFO] +- com.yammer.dropwizard:dropwizard-core:jar:0.6.1:compile | |
[INFO] | +- com.sun.jersey:jersey-core:jar:1.15:compile | |
[INFO] | +- com.sun.jersey:jersey-server:jar:1.15:compile | |
[INFO] | | \- asm:asm:jar:3.1:compile | |
[INFO] | +- com.sun.jersey:jersey-servlet:jar:1.15:compile | |
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile | |
[INFO] | +- com.yammer.metrics:metrics-servlet:jar:2.2.0:compile | |
[INFO] | +- com.yammer.metrics:metrics-jetty:jar:2.2.0:compile |
View context_processors.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#make some settings accessible via settings.FOO from within templates | |
from django.conf import settings | |
def exposed_settings(request): | |
context_settings = dict() | |
for x in settings.TEMPLATE_CONTEXT_SETTINGS: | |
context_settings[x] = getattr(settings, x) | |
return { 'settings': context_settings } |
View form_sluggify.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Copyright (c) 2009 Mikhail Panchenko | |
#MIT License http://www.opensource.org/licenses/mit-license.php | |
class AddBmarkForm(forms.Form): | |
name = forms.CharField(max_length=50, required=False) | |
description = forms.CharField(max_length=255, required=True) | |
def clean_description(self): | |
desc = self.cleaned_data['description'] | |
name = slugify(desc).decode() |
View appEngineUserRequired.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Copyright (c) 2009 Mikhail Panchenko | |
#MIT License http://www.opensource.org/licenses/mit-license.php | |
def userRequired(fn): | |
"""decorator for forcing a login""" | |
def new(*args, **kws): | |
user = users.get_current_user() | |
if not (user): | |
r = args[0] | |
return HttpResponseRedirect(users.create_login_url( |
View request_param_pseudo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$argsToPass = array(); | |
$args = ReflectionMethod->getParams(); | |
/*you got an array of param names in the order they appear in the method signature */ | |
foreach ($args as $arg) { | |
if (!isset($_REQUEST[$arg])) { //check if the arg is optional and fail if not } | |
$argsToPass[] = $_REQUEST[$arg]; | |
} | |
$ReflectionMethod->invoke($argsToPass); | |
?> |