This file contains hidden or 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
from django.views.generic import View | |
from django.core.exceptions import ImproperlyConfigured | |
from django.contrib.auth.views import login | |
class WrapperView(View): | |
@property | |
def view_function(self): | |
raise ImproperlyConfigured("You must define a 'view_function'.") |
This file contains hidden or 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
from fabric.contrib import files | |
def append(): | |
files.append( '~/append_test', ['line']) | |
files.append( '~/append test with space', ['line']) | |
def exists(): | |
print(files.exists('~/exists_test')) | |
print(files.exists('~/exists test with space')) |
This file contains hidden or 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
class UserFactory(factory.Factory): | |
password = 'test' | |
@classmethod | |
def _prepare(cls, create, **kwargs): | |
password = kwargs.pop('password', None) | |
user = super(UserFactory, cls)._prepare(create, **kwargs) | |
if password: | |
user.raw_password = password | |
user.set_password(password) |
This file contains hidden or 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
import os | |
from fabric.api import run, cd, env, abort | |
from fabric.contrib.console import confirm | |
from fabric.context_managers import prefix | |
from fabric.tasks import Task | |
env.hosts = ['sample@example.com'] | |
env.settings = ['staging', 'production'] |
This file contains hidden or 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
#! /usr/bin/env python3 | |
import os | |
import sys | |
import subprocess | |
if len(sys.argv) == 1: | |
files = os.listdir('.') | |
else: | |
files = sys.argv[1:] |
NewerOlder