code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache
f... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013.7.1
Date model
@author: lzy
'''
import datetime
from google.appengine.ext import db
'''note model'''
class Note(db.Model):
gmt_create = db.DateProperty()
gmt_modified = db.DateProperty()
operator = db.StringProperty()
content = db.TextProperty()
tag =... | Python |
# -*- coding: utf-8 -*-
'''
Created on 2013年7月1日
Data DAO
@author: lzy
'''
from google.appengine.ext import db
import logging
class NoteDAO:
def save(self, noteDO):
logging.info("save noteDO start")
db.put(noteDO)
def delete(self, key):
logging.info("delete noteDO")
d... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.runtime
~~~~~~~~~~~~~~
Runtime helpers.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from itertools import chain, imap
from jinja2.nodes import EvalContext, _context_function_types
from jinja2.utils import Markup, partial, soft_unicode, escape, miss... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.bccache
~~~~~~~~~~~~~~
This module implements the bytecode cache system Jinja is optionally
using. This is useful if you have very complex template situations and
the compiliation of all those templates slow down your application too
much.
Situations whe... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.compiler
~~~~~~~~~~~~~~~
Compiles nodes into python code.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from cStringIO import StringIO
from itertools import chain
from copy import deepcopy
from jinja2 import nodes
from j... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.meta
~~~~~~~~~~~
This module implements various functions that exposes information about
templates that might be interesting for various kinds of applications.
:copyright: (c) 2010 by the Jinja Team, see AUTHORS for more details.
:license: BSD, see LICENSE fo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.nodes
~~~~~~~~~~~~
This module implements additional nodes derived from the ast base node.
It also provides some node tree helper functions like `in_lineno` and
`get_nodes` used by the parser and translator in order to normalize
python and jinja nodes.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
try:
from collections import Mapping as MappingType
... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.debug
~~~~~~~~~~~~
Implements the debug interface for Jinja. This module does some pretty
ugly stuff with the Python traceback system in order to achieve tracebacks
with correct line numbers, locals and contents.
:copyright: (c) 2010 by the Jinja Team.
:... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.optimizer
~~~~~~~~~~~~~~~~
The jinja optimizer is currently trying to constant fold a few expressions
and modify the AST in place so that it should be easier to evaluate it.
Because the AST does not contain all the scoping information and the
compiler has to ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.lexer
~~~~~~~~~~~~
This module implements a Jinja / Python combination lexer. The
`Lexer` class provided by this module is used to do some preprocessing
for Jinja.
On the one hand it filters out invalid operators like the bitshift
operators we don't allow... | Python |
# -*- coding: utf-8 -*-
"""
jinja.constants
~~~~~~~~~~~~~~~
Various constants.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
#: list of lorem ipsum words used by the lipsum() helper function
LOREM_IPSUM_WORDS = u'''\
a ac accumsan ad adipiscing aenean a... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.sandbox
~~~~~~~~~~~~~~
Adds a sandbox layer to Jinja as it was the default behavior in the old
Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the
default behavior is easier to use.
The behavior can be changed by subclassing the environm... | Python |
import gc
import unittest
from jinja2._markupsafe import Markup, escape, escape_silent
class MarkupTestCase(unittest.TestCase):
def test_markup_operations(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
sa... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._constants
~~~~~~~~~~~~~~~~~~~~~
Highlevel implementation of the Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
HTML_ENTITIES = {
'AElig': 198,
'Aacute': 193,
'Acirc': 194,
'Agrave': 1... | Python |
# -*- coding: utf-8 -*-
"""
jinja2._markupsafe._bundle
~~~~~~~~~~~~~~~~~~~~~~~~~~
This script pulls in markupsafe from a source folder and
bundles it with Jinja2. It does not pull in the speedups
module though.
:copyright: Copyright 2010 by the Jinja team, see AUTHORS.
:license: BSD, see ... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe
~~~~~~~~~~
Implements a Markup string.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import re
from itertools import imap
__all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
_striptags_re = re.compile... | Python |
# -*- coding: utf-8 -*-
"""
markupsafe._native
~~~~~~~~~~~~~~~~~~
Native Python implementation the C module is not compiled.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from jinja2._markupsafe import Markup
def escape(s):
"""Convert the characters... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.loaders
~~~~~~~~~~~~~~
Jinja loader classes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import weakref
from types import ModuleType
from os import path
try:
from hashlib import sha1
except Imp... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import sys
import errno
try:
from thread import allocate_lock
except ImportError:
from dummy_thread import allocate_lo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.ext
~~~~~~~~~~
Jinja extensions allow to add custom tags similar to the way django custom
tags work. By default two example extensions exist: an i18n and a cache
extension.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from collections impor... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.exceptions
~~~~~~~~~~~~~~~~~
Jinja exceptions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
class TemplateError(Exception):
"""Baseclass for all template errors."""
def __init__(self, message=None):
i... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.environment
~~~~~~~~~~~~~~~~~~
Provides a class that holds runtime and parsing time options.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from jinja2 import nodes
from jinja2.defaults import *
from ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.filters
~~~~~~~~~~~~~~
Bundled jinja filters.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import math
from random import choice
from operator import itemgetter
from itertools import imap, groupby
from jinja2.... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.defaults
~~~~~~~~~~~~~~~
Jinja default filters and tags.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner
# defaults for the parser / lexer
BLOCK_START_STRING ... | Python |
# -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.parser
~~~~~~~~~~~~~
Implements the template parser.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2 import nodes
from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError
from jinja2.utils impo... | Python |
# -*- coding: utf-8 -*-
"""
jinja2.visitor
~~~~~~~~~~~~~~
This module implements a visitor for the nodes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from jinja2.nodes import Node
class NodeVisitor(object):
"""Walks the abstract syntax tree and call visitor functions for every... | Python |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
import datetime
import hashlib
import hmac
import logging
import pickle
import os
import threading
import time
from google.appengine.api import memcache
f... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
'''
Created on 2013-3-26
google app engine data model
@author: lzy
'''
from google.appengine.ext import db
#words
class Words(db.Model):
title = db.StringProperty()
body = db.TextProperty()
created = db.DateTimeProperty(auto_now_add=True)
#comment
class Comment(db.Model):
pass
| Python |
'''
Created on 2013-3-25
@author: lzy
'''
from framework.bottle import Bottle
wordc = Bottle()
@wordc.route('/')
def welcome():
return "words words" | Python |
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle,redirect,request
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from google.appengine.api import users
#jinja2
env = Environment(loader = FileSystemLoader('templates'))
indexc = Bo... | Python |
'''
Created on 2013-3-25
@author: zhiyong.luo
'''
from framework.bottle import Bottle, debug,redirect, static_file
from google.appengine.ext.webapp.util import run_wsgi_app
from app.index import indexc
from app.words import wordc
#root app
root = Bottle()
root.mount("/index.html", indexc)
root.mount("/... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Python |
#!/usr/bin/env python
#encoding: latin1
def quick_sort(lista, comparador):
"""Ordena la lista de forma recursiva"""
_quick_sort(lista, 0, len(lista) - 1, comparador)
def _quick_sort(lista, inicio, fin, comparador):
"""Funcion quick_sort recursiva"""
if inicio >= fin:
return
menores = _partition(lista, inicio,... | Python |
#!/usr/bin/env python
#encoding: latin1
import sys
class Nodo(object):
""" Clase nodo. """
def __init__(self, indice, numero, nombre):
""" Crea nodo. Recibe todo en string. """
self._indice = int(indice)
self._numero = numero
self._nombre = nombre
self._adyacentes = []
self._grado_entrada = 0
self.in... | Python |
#!/usr/bin/env python
#encoding: latin1
def quick_sort(lista, comparador):
"""Ordena la lista de forma recursiva"""
_quick_sort(lista, 0, len(lista) - 1, comparador)
def _quick_sort(lista, inicio, fin, comparador):
"""Funcion quick_sort recursiva"""
if inicio >= fin:
return
menores = _partition(lista, inicio,... | Python |
#!/usr/bin/env python
#encoding: latin1
import sys
class Nodo(object):
""" Clase nodo. """
def __init__(self, indice, numero, nombre):
""" Crea nodo. Recibe todo en string. """
self._indice = int(indice)
self._numero = numero
self._nombre = nombre
self._adyacentes = []
self._grado_entrada = 0
self.in... | Python |
#!/usr/bin/env python
#encoding: latin1
from collections import deque
import classgrafo
import quicksort
def adynodo_in_adypadre(nodo, padre):
"""Pre:Recibe un nodo clase nodo y un padre clase nodo. Padre es adyacentes de nodo y nodo es adyacente de padre.
Post: Devuelve True si los adyacentes de nodo son adyacente... | Python |
#!/usr/bin/env python
#encoding: latin1
from collections import deque
import classgrafo
import quicksort
def adynodo_in_adypadre(nodo, padre):
"""Pre:Recibe un nodo clase nodo y un padre clase nodo. Padre es adyacentes de nodo y nodo es adyacente de padre.
Post: Devuelve True si los adyacentes de nodo son adyacente... | Python |
#!/usr/bin/env python
#encoding: latin1
def expresar_como_perfilciudad(listaedificios):
resultado = ""
if (len(listaedificios) > 0):
resultado += str(listaedificios[0][0])
contador = 1
for edificio in listaedificios:
resultado+=","
if (int(resultado[len(resultado)-2]) < edificio[0]):
resultado+= "0,"... | Python |
#!/usr/bin/env python
#encoding: latin1
def expresar_como_perfilciudad(listaedificios):
resultado = ""
if (len(listaedificios) > 0):
resultado += str(listaedificios[0][0])
contador = 1
for edificio in listaedificios:
resultado+=","
if (int(resultado[len(resultado)-2]) < edificio[0]):
resultado+= "0,"... | Python |
#!/usr/bin/env python
#encoding: latin1
class DatosPunto2(object):
""" Clase para guardar los datos de entrada """
def __init__(self):
self._cantidad_meses = 0
self._capacidad_deposito = 0
self._costo_almacenar = 0
self._tasa_orden_compra = 0
self._demanda = []
@property
def cantidad_meses(self):
retu... | Python |
#!/usr/bin/env python
#encoding: latin1
class DatosPunto2(object):
""" Clase para guardar los datos de entrada """
def __init__(self):
self._cantidad_meses = 0
self._capacidad_deposito = 0
self._costo_almacenar = 0
self._tasa_orden_compra = 0
self._demanda = []
@property
def cantidad_meses(self):
retu... | Python |
#!/usr/bin/env python
#encoding: latin1
def quick_sort(lista, comparador):
"""Ordena la lista de forma recursiva"""
_quick_sort(lista, 0, len(lista) - 1, comparador)
def _quick_sort(lista, inicio, fin, comparador):
"""Funcion quick_sort recursiva"""
if inicio >= fin:
return
menores = _partition(lista, inicio,... | Python |
#!/usr/bin/env python
#encoding: latin1
def quick_sort(lista, comparador):
"""Ordena la lista de forma recursiva"""
_quick_sort(lista, 0, len(lista) - 1, comparador)
def _quick_sort(lista, inicio, fin, comparador):
"""Funcion quick_sort recursiva"""
if inicio >= fin:
return
menores = _partition(lista, inicio,... | Python |
#!/usr/bin/env python
#encoding: latin1
import quicksort
class Trabajo(object):
def __init__(self, numero, tiempo, beneficio, vencimiento):
self._numero = int(numero)
self._tiempo = int(tiempo)
self._beneficio = int(beneficio)
self._vencimiento = int(vencimiento)
@property
def numero(self):
return self... | Python |
#!/usr/bin/env python
#encoding: latin1
import quicksort
class Trabajo(object):
def __init__(self, numero, tiempo, beneficio, vencimiento):
self._numero = int(numero)
self._tiempo = int(tiempo)
self._beneficio = int(beneficio)
self._vencimiento = int(vencimiento)
@property
def numero(self):
return self... | Python |
from django.db import models
from django.contrib.auth.models import User
from django.db import connection
class Tag(models.Model):
"""A job or an entry can be tagged with this."""
name = models.CharField(max_length = 50)
user = models.ForeignKey(User)
create_on = models.DateTimeField(auto_now_a... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to, direct_to_template
urlpatterns = patterns('mytym.views',
# Example:
(r'^$', 'index'),
(r'^help/$', direct_to_template, {'template':'mytym/about.html'}),
(r'^jobs/$', 'handle_jobs'),
(r'^entries/$', ... | Python |
num_rows = 4
| Python |
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
#from django.views.generic.simple import object_list
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.conf import setting... | Python |
from django import newforms as forms
from django.core.exceptions import ObjectDoesNotExist
import re
from models import *
class JobsForm(forms.Form):
name = forms.CharField(max_length = 100)
default_tag = forms.CharField(max_length = 50)
def set_user(self, user):
self.user = user
de... | Python |
# Django settings for timetrack project.
import os.path
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'mytym' ... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout, password_change, password_reset
#Account management view
urlpatterns = patterns('',
url(r'^accounts/login/$', login, {'template_name': 'registration/login.html'}, 'login'),
url(r'^accounts/logout/$', logout, {'t... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
# Django settings for djangolancers project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'jobs' # Or... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
(r'^', include('djobboard.jobs.urls')),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
| Python |
from django.db import models
class Developer(models.Model):
name = models.CharField(max_length = 100)
description = models.TextField()
email = models.EmailField()
website = models.URLField(null = True)
location = models.CharField(null = True, max_length = 100)
created_on = models.DateTi... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('jobs.views',
# Example:
(r'^$', 'index'),
(r'^adddev/$', 'add_developer'),
(r'^addjob/$', 'add_job'),
(r'^developers/$', 'developers'),
(r'^jobs/$', 'jobs'),
... | Python |
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseForbidden
from django.views.generic.list_detail import object_list, object_detail
from django.shortcuts import render_to_response
import django.newforms as forms
import models
def index(request):
return add_developer(request)... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
import os.path
#DEBUG = True
#TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'djpaste' # Or path to database file if... | Python |
from django.db import models
class CodePaste(models.Model):
text = models.TextField()
htmld_text = models.TextField()
language = models.CharField(max_length=30)
title = models.CharField(max_length = 50)
name = models.CharField(max_length = 50)
created_on = models.DateField(auto_now_add ... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('djpaste.views',
(r'^$', 'index'),
(r'^help/$', direct_to_template, {'template':'djpaste/help.html'}),
(r'^paste/(?P<id>\d+)/$', 'paste_details'),
(r'^plain/(... | Python |
import django.newforms as forms
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from models import CodePaste
def index(request):
if request.method == 'POST':
form = PasteForm(request.POST)
if form.is_valid():
past... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
(r'^', include('pastebin.djpaste.urls'))
# (r'^pastebin/', include('pastebin.foo.urls')),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
| Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
# Django settings for polls project.
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'pollngo' ... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
(r'^', include('polls.pollngo.urls')),
# Uncomment this for admin:
# (r'^admin/', include('django.contrib.admin.urls')),
)
| Python |
from django.db import models
from django.contrib.auth.models import User
class Question(models.Model):
"""This class represents a question. It can have 2 or more options."""
created_on = models.DateTimeField(auto_now_add = 1)
title = models.SlugField(max_length = 200)
slug = models.SlugField(uni... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('pollngo.views',
(r'^$', 'index'),
(r'^poll/(?P<slug>[^\.^/]+)/$', 'question'),
(r'^create/$', 'create'),
(r'^help/$', 'help'),
(r'^results/(?P<slug>[^\.^/]+)/$', 'resul... | Python |
from django import newforms as forms
import models
class CreatePoll(forms.Form):
question_title = forms.CharField(widget = forms.TextInput(attrs = {'class':'required', 'size':50}), help_text = 'Title for your poll. This is required.')
question_text = forms.CharField(widget = forms.Textarea, help_text = 'S... | Python |
"""
PyGoogleChart - A complete Python wrapper for the Google Chart API
http://pygooglechart.slowchop.com/
Copyright 2007 Gerald Kaszuba
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, eith... | Python |
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.http import Http404
from django.core.exceptions import ObjectDoesNotExist
from models import *
import pforms
from pygooglechart import PieChart2D
... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
# Django settings for kasekamp project.
import os.path
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'kamp' ... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
(r'^', include('kasekamp.kamp.urls')),
)
| Python |
from django.db import models
from django.contrib.auth.models import User
class Projset(models.Model):
"""The project set for a user. Contains all their projects."""
name = models.CharField(unique = True, max_length = 100)
user = models.ForeignKey(User, unique = True)
def get_absolute_url(s... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib.auth.views import login, logout, password_change, password_reset
#Account management view
urlpatterns = patterns('',
url(r'^accounts/login/$', login, {'template_name': 'registration/login.h... | Python |
from django import newforms as forms
from models import *
import re
from django.contrib.auth.models import User
from django.newforms import ValidationError
from django.utils.translation import ugettext as _
class UserCreationForm(forms.Form):
"""A form that creates a user, and adds a projectset for her""... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
# Django settings for answers project.
import os.path
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'answrs' ... | Python |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha... | Python |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^answers/', include('answers.foo.urls')),
(r'^admin/', include('django.contrib.admin.urls')),
(r'', include('answers.answrs.urls')),
# Uncomment this for admin:
)
| Python |
from django.db import models
from django.contrib.auth.models import User
import Image
from django.conf import settings
import os.path
import re
import shutil
class UserProfile(models.Model):
user = models.ForeignKey(User, unique = True)
best_answers = models.IntegerField(default = 0)
answers =... | Python |
from django import newforms as forms
from models import *
from django.contrib.auth.models import User
from django.newforms import ValidationError
from django.utils.translation import ugettext as _
class QuestionForm(forms.Form):
category = forms.ChoiceField()
title = forms.CharField(max_length = ... | Python |
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.contrib.auth.views import login, logout
#Account management view
urlpatterns = patterns('',
url(r'^accounts/login/$', login, {'template_name': 'registration/login.html'}, 'login'),
url(r'^acco... | Python |
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404, HttpResponseRedirect
def handle404 (view_function):
"""If we are not in debug mode, convert ObjectDoesNotExist to Http404"""
def wrapper (*args, **kwargs):
if not settings.DEBU... | Python |
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden
from models import *
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
import datetime
import random
from decorators import handle40... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.