code
stringlengths
1
1.72M
language
stringclasses
1 value
# Fat Defines... FAT_MAGIC = 0xcafebabe FAT_CIGAM = 0xbebafec #NXSwapLong(FAT_MAGIC) MH_MAGIC = 0xfeedface # the mach magic number MH_CIGAM = 0xcefaedfe # NXSwapInt(MH_MAGIC) MH_MAGIC_64 = 0xfeedfacf # the 64-bit mach magic number MH_CIGAM_64 = 0xc...
Python
import vstruct import vstruct.primitives as vs_prim class fat_header(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self, bigend=True) self.magic = vs_prim.v_uint32() self.nfat_arch = vs_prim.v_uint32() class fat_arch(vstruct.VStruct): def __init__(self): vstru...
Python
''' Structure definitions for the OSX MachO binary format. ''' import vstruct import vstruct.primitives as vs_prim from vstruct.defs.macho.const import * from vstruct.defs.macho.fat import * from vstruct.defs.macho.loader import *
Python
import vstruct import vstruct.primitives as vs_prim vm_prot_t = vs_prim.v_uint32 cpu_type_t = vs_prim.v_uint32 cpu_subtype_t = vs_prim.v_uint32 lc_str = vs_prim.v_uint32 class mach_header(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.magic = vs_prim.v_uint32() # m...
Python
import vstruct from vstruct.primitives import * class IMAGE_BASE_RELOCATION(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.VirtualAddress = v_uint32() self.SizeOfBlock = v_uint32() class IMAGE_DATA_DIRECTORY(vstruct.VStruct): def __init__(self): v...
Python
# Version: 6.1 # Architecture: amd64 import vstruct from vstruct.primitives import * KPROCESS_STATE = v_enum() KPROCESS_STATE.ProcessInMemory = 0 KPROCESS_STATE.ProcessOutOfMemory = 1 KPROCESS_STATE.ProcessInTransition = 2 KPROCESS_STATE.ProcessOutTransition = 3 KPROCESS_STATE.ProcessInSwap = 4 KPROCESS_STA...
Python
# Version: 5.1 # Architecture: i386 import vstruct from vstruct.primitives import * DEVICE_RELATION_TYPE = v_enum() DEVICE_RELATION_TYPE.BusRelations = 0 DEVICE_RELATION_TYPE.EjectionRelations = 1 DEVICE_RELATION_TYPE.PowerRelations = 2 DEVICE_RELATION_TYPE.RemovalRelations = 3 DEVICE_RELATION_TYPE.TargetDev...
Python
# Version: 5.1 # Architecture: i386 import vstruct from vstruct.primitives import * POLICY_AUDIT_EVENT_TYPE = v_enum() POLICY_AUDIT_EVENT_TYPE.AuditCategorySystem = 0 POLICY_AUDIT_EVENT_TYPE.AuditCategoryLogon = 1 POLICY_AUDIT_EVENT_TYPE.AuditCategoryObjectAccess = 2 POLICY_AUDIT_EVENT_TYPE.AuditCategoryPrivi...
Python
# Version: 5.1 # Architecture: i386 import vstruct from vstruct.primitives import * DEVICE_RELATION_TYPE = v_enum() DEVICE_RELATION_TYPE.BusRelations = 0 DEVICE_RELATION_TYPE.EjectionRelations = 1 DEVICE_RELATION_TYPE.PowerRelations = 2 DEVICE_RELATION_TYPE.RemovalRelations = 3 DEVICE_RELATION_TYPE.TargetDev...
Python
# Version: 6.1 # Architecture: i386 import vstruct from vstruct.primitives import * KPROCESS_STATE = v_enum() KPROCESS_STATE.ProcessInMemory = 0 KPROCESS_STATE.ProcessOutOfMemory = 1 KPROCESS_STATE.ProcessInTransition = 2 KPROCESS_STATE.ProcessOutTransition = 3 KPROCESS_STATE.ProcessInSwap = 4 KPROCESS_STAT...
Python
''' The pre-made windows structure defs (extracted from pdb syms) ''' import envi import ctypes import platform def isSysWow64(): k32 = ctypes.windll.kernel32 if not hasattr(k32, 'IsWow64Process'): return False ret = ctypes.c_ulong(0) myproc = ctypes.c_size_t(-1) if not k32.I...
Python
""" Initial module with supporting structures for windows kernel serial debugging. """ import vstruct from vstruct.primitives import * # Main packet magic bytes and such BREAKIN_PACKET = 0x62626262 BREAKIN_PACKET_BYTE = 0x62 PACKET_LEADER = 0x30303...
Python
# Import all local structure modules import elf import pe import win32
Python
#!/usr/bin/python import sys sn_header = """// Serial number 10, // bLength USB_DESC_STRING, // bDescriptorType """ try: ser = int(file(".serial", 'rb').read()) + 1 except IOError: ser = 0 print("[--- new serial number: %.4d ---]" % ser) file(".ser...
Python
#!/usr/bin/env ipython import sys, threading, time, struct, select import usb import bits from chipcondefs import * EP_TIMEOUT_IDLE = 400 EP_TIMEOUT_ACTIVE = 10 USB_RX_WAIT = 100 USB_TX_WAIT = 10000 USB_BM_REQTYPE_TGTMASK =0x1f USB_BM_REQTYPE_TGT_DEV =0x00 USB_BM_REQTYPE_TGT...
Python
#!/usr/bin/python import sys, serial port = "ACM0" if len(sys.argv) > 1: port = sys.argv.pop() dport = "/dev/tty" + port print "Opening serial port %s for listening..." % dport s=serial.Serial(dport, 115200) counter = 0 while True: print ("%d: %s" % (counter, repr(s.read(12)))) counter += 1 #sys.std...
Python
import struct def shiftString(string, bits): carry = 0 news = [] for x in xrange(len(string)-1): newc = ((ord(string[x]) << bits) + (ord(string[x+1]) >> (8-bits))) & 0xff news.append("%c"%newc) newc = (ord(string[-1])<<bits) & 0xff news.append("%c"%newc) return "".join(news) de...
Python
#!/usr/bin/env python """ #include<compiler.h> /* ------------------------------------------------------------------------------------------------ * Interrupt Vectors * ------------------------------------------------------------------------------------------------ */ #define RFT...
Python
#!/usr/bin/env ipython from chipcon_nic import * class RfCat(FHSSNIC): def RFdump(self, msg="Receiving", maxnum=100, timeoutms=1000): try: for x in xrange(maxnum): y, t = self.RFrecv(timeoutms) print "(%5.3f) %s: %s" % (t, msg, y.encode('hex')) except Ch...
Python
#!/usr/bin/env ipython import sys import usb import code import time import struct import threading #from chipcondefs import * from cc1111client import * APP_NIC = 0x42 NIC_RECV = 0x1 NIC_XMIT = 0x2 NIC_SET_ID = 0x3 NIC_RFMODE = ...
Python
import vstruct from vstruct.primitives import * class RadioConfig(vstruct.VStruct): def __init__(self): vstruct.VStruct.__init__(self) self.sync1 = v_uint8() #df00 self.sync0 = v_uint8() #df01 self.pktlen = v_uint8() #df02 self.pktctrl1 = v_...
Python
import re class tokenizer(object): def __init__(self, tokens, filename): self.tokens = tokens self.stream = 0 parts = [] for name, part in tokens: parts.append("(?P<%s>%s)" % (name, part)) self.regexpString = "|".join(parts) self.regexp = re.compile(self....
Python
import sys import tokenizer class lpparser(object): def __init__(self,filename): self.tokens = [ ("variable", "[A-Za-z]+[0-9]+"), ("number", "[0-9]+"), ("sign", "[\+\-]"), ("relational", "[<>]{0,1}="), ("eol", "\n"), ] self...
Python
#!/usr/bin/env python '''PyLibrarian database helper functions''' import ConfigParser from datetime import datetime, timedelta from sqlalchemy.sql.functions import count from sqlalchemy.sql.expression import or_ from hashlib import sha256 import model config = ConfigParser.ConfigParser() config.readfp(open('config.in...
Python
#!/usr/bin/env python '''A PyGame, kiosk-style client for PyLibrarian''' import sys import ConfigParser import pygame import database from time import time, sleep config = ConfigParser.ConfigParser() config.readfp(open('config.ini')) libraryName = config.get('library', 'name') timeout = config.getint('client', 'sess...
Python
#!/usr/bin/env python import sys import database import ConfigParser from smtplib import SMTP try: # 2.5 compatibility from smtplib import SMTP_SSL except ImportError: pass from email.MIMEText import MIMEText from email.Header import Header from email.Utils import parseaddr, formataddr config = ConfigParser...
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 and with no dependencies...
Python
#!/usr/bin/env python '''PyLibrarian database model''' import ConfigParser from datetime import datetime, timedelta from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.types import * from sqlalchemy.schema import * from sqlalchemy.engine import create_engine from sqlalchemy.orm import scoped_sessio...
Python
#!/usr/bin/env python '''PyLibrarian label generator (for generating book labels to be printed on Avery 5160/8160 or compatible address labels)''' try: import json except ImportError: import simplejson as json import ConfigParser from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import ...
Python
#!/usr/bin/env python '''PyLibrarian web administration interface''' import ConfigParser import math import database import model import urllib2 import traceback import codecs import pdfGen import os from bottle import * from xml.dom import minidom from beaker.middleware import SessionMiddleware try: import json e...
Python
# Django settings for website project. import os ROOT_PATH = os.path.dirname(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_...
Python
from django.conf.urls import patterns, include, url from inmobiliarias.views import * # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', HomeView.as_view(), name='home'), url(r'^buscar/?$', ResultadoBusquedaView.as_view(...
Python
""" WSGI config for website project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` ...
Python
from django.db import models from django.contrib.auth.models import User, UserManager ESTADOS_CHOICES = ( ('A Estrenar', 'A Estrenar'), ('Excelente', 'Excelente'), ('Muy Bueno', 'Muy Bueno'), ('Bueno', 'Bueno'), ('Malo', 'Malo'), ('-', '-'), #agregar las "para reciclar"/demoler ) TIPO_CAMPO_CHOICES = ( ('', '...
Python
from django.forms import ModelForm, Form, ModelChoiceField, IntegerField, CharField, Select from models import * class PropiedadSearchForm(Form): provincia = CharField(max_length=25, widget= Select(choices=PROVINCIAS_CHOICES)) ciudad = CharField(max_length=25, widget= Select(choices=CIUDADES_CHOICES)) tipo = CharF...
Python
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 a...
Python
from django.http import HttpResponse, Http404 from django.shortcuts import render_to_response, get_object_or_404 from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.generic import TemplateView,...
Python
from inmobiliarias.models import * from django.contrib import admin admin.site.register(Propiedad) admin.site.register(Inmobiliaria) admin.site.register(Departamento) admin.site.register(Casa)
Python
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "website.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Python
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you ...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Sets the property in a java property file to the specified value, or adds it if it isn't present. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. # NOTE: This is a huge amount of broilerplate, isn't there any better command line reader utility? ...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#! /usr/bin/python # Google code issue system to changelist.txt generator. # Programmed 2008-11 by Hans Haggstrom (zzorn at iki.fi) # Public domain, adapt and use as you want. import csv, getopt, os, sys, datetime, time from distutils import version def usage(): print print 'Google code issue downloader and c...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import re import cgi import traceback try: import json except: import simplejson as json import threading import functools from xml.dom.minidom import parseString ''' import sae.const 'database':{ 'db':sae.const.MYSQL_DB, ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from flying import * app = Flying() @route('/') def index(): return render_to_response('hello.html',{'hello':'欢迎'}) @route('/json', type = 'json') def json(): return dict(a = 123) @route('/xml', type = 'xml') def xml(): return "<my...
Python
#!/usr/bin/env python ############################################################################### # # MODULE: m.fuzzy.sensitivity # AUTHOR: Thomas Leppelt # PURPOSE: Compute sensitivity anaylsis for fuzzy models in ranges of given # raster cell maps or by direct input and plotting t...
Python
#!/usr/bin/env python ############################################################################### # # MODULE: m.fuzzy.sensitivity # AUTHOR: Thomas Leppelt # PURPOSE: Compute sensitivity anaylsis for fuzzy models in ranges of given # raster cell maps or by direct input and plotting t...
Python
#!/usr/bin/env python ############################################################################ # # MODULE: m.ecad # AUTHOR: Thomas Leppelt # PURPOSE: Import, registration,aggregation and observation of ECA&D climate data. # ############################################################################# #%modul...
Python
#!/usr/bin/env python ############################################################################ # # MODULE: m.ecad # AUTHOR: Thomas Leppelt # PURPOSE: Import, registration,aggregation and observation of ECA&D climate data. # ############################################################################# #%modul...
Python
#!/usr/bin/env python ################################################################################################### # # MODULE: m.fuzzy.validation # AUTHOR: Thomas Leppelt # PURPOSE: Selection, calibration and validation of parameter combinations for fuzzy models. # #########################################...
Python
#!/usr/bin/env python ################################################################################################### # # MODULE: m.fuzzy.validation # AUTHOR: Thomas Leppelt # PURPOSE: Selection, calibration and validation of parameter combinations for fuzzy models. # #########################################...
Python
#!/usr/bin/env python ############################################################################### # # MODULE: m.fuzzy.upscale # AUTHOR: Thomas Leppelt # PURPOSE: Application of calibrated fuzzy models on raster maps with option # to use empirical distribution function as input maps to generate ...
Python
#!/usr/bin/env python ############################################################################### # # MODULE: m.fuzzy.upscale # AUTHOR: Thomas Leppelt # PURPOSE: Application of calibrated fuzzy models on raster maps with option # to use empirical distribution function as input maps to generate ...
Python
import unittest import os import getpass import warnings import ConfigParser import ast import csv import filecmp import pyfmdb import re import psycopg2 import code, traceback def create_tests(host, port, admin, password, test_update, source_dir, test_dir): class FMDBTestCase(unittest.TestCase): ...
Python
fmdb = '0.0.0' api = '0.0.0' db = '0.0.0'
Python
import os import sys import csv import psycopg2 as pg import pyodbc import traceback, code import VERSION import itertools import StringIO import glob import stat from datetime import datetime import fnmatch import xlrd import string import re import shutil import pyfmdb import pyodbc from collection...
Python
__all__ = ['pyfmdb']
Python
from sys import stdin from Token import Token class Lexer: def __init__(self): self.l = "" def nextToken(self): if (len(self.l) == 0): c = str(stdin.read(1)) s = "" while(c.isdigit()): s += c c = str(stdin.read(1)) if (len(s) > 0): t = Token(s, "INT") self.l = c return t el...
Python
from sys import stdin from sys import exit class Interpreter: def __init__(self): self.stack = [] self.s = stdin.readlines() self.errormsg = "" def interpret(self): if (len(self.s) < 2): self.errormsg = "No input" self.error() for line in self.s: if line[0] == 'P': if line[0:4] == "PUSH":...
Python
from Lexer import Lexer from Parser import Parser import sys class Compiler: if __name__ == "__main__": myLexer = Lexer() myParser = Parser(myLexer) myParser.parse()
Python
from Lexer import Lexer from sys import exit from sys import stdout from sys import stdin class Parser: def __init__(self,l): self.lex = l self.t = None def parse(self): self.t = self.lex.nextToken() self._expr() print "PRINT" if not (stdin.isatty()): if (stdin.read(1)): print "ERROR" def _...
Python
class Token: def __init__(self, lex, tokencode): self.tCode = tokencode self.lexeme = lex
Python
# Django settings for pastesite project. import os STATIC_PATH = os.getcwd() DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '...
Python
#!/usr/bin/python import os, sys _PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, _PROJECT_DIR) sys.path.insert(0, os.path.dirname(_PROJECT_DIR)) _PROJECT_NAME = _PROJECT_DIR.split('/')[-1] os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME from django.c...
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 have to ...
Python
from django.conf.urls.defaults import * import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': set...
Python
#!/usr/bin/python import os, sys _PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, _PROJECT_DIR) sys.path.insert(0, os.path.dirname(_PROJECT_DIR)) _PROJECT_NAME = _PROJECT_DIR.split('/')[-1] os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME from django.c...
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 have to ...
Python
# Django settings for improgrammer project. import sys, os CURDIR = os.getcwd() DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAM...
Python
from django.db import models from django.contrib.auth.models import User # Create your models here. class Member(models.Model): member = models.ForeignKey(User, related_name = 'member_user') lastLoginTime = models.DateTimeField(auto_now_add = True) entryCount = models.IntegerField(default = 0) comment...
Python
#-*-coding:utf-8-*- from django import forms class RegisterForm(forms.Form): username = forms.CharField(max_length = 75, label = u'用户名') password = forms.CharField(widget = forms.PasswordInput, label = u'密码') password_confirm = forms.CharField(widget = forms.PasswordInput, label = u'密码确认') email = for...
Python
#-*-coding:utf-8-*- from improgrammer.programmer.models import * from improgrammer.programmer.forms import * from django.shortcuts import render_to_response from django.http import HttpRequest from django.http import HttpResponse from django.http import HttpResponseRedirect from django.core.paginator import Paginato...
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 have to ...
Python
from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^improgrammer/', include('improgrammer.foo.urls')), # Uncomment the admin/doc line ...
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 have to ...
Python
# Django settings for pinkewang project. import os CURRENT_PATH = os.getcwd() DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('kingheaven', 'mykingheaven@gmail.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'p...
Python
from django.db import models # Create your models here.
Python
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ ...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('pinkewang.pinke.views', )
Python
# Create your views here.
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 have to ...
Python
#-*-coding:utf-8-*- from django.db import models from django.contrib import admin from django.db.models import permalink from django.contrib.auth.models import User # Create your models here. GENDER_CHOICES= (('m', u'先生'), ('f', u'女士')) class Member(models.Model): user = models.ForeignKey(User) telephone = mo...
Python
from django import forms from django.forms import ModelForm from pinkewang.member.models import * class RegisterForm(forms.Form): username = forms.CharField(max_length = 15) password = forms.CharField(max_length = 15, widget = forms.PasswordInput) passwordConfirm = forms.CharField(max_length = 15, widget =...
Python
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ ...
Python
#-*-coding:utf-8-*- # Create your views here. from django.shortcuts import * from django.contrib.auth.models import User from django.contrib.auth import * from django.contrib.auth.decorators import * from django.template import * from pinkewang.member.forms import * from pinkewang.member.models import * def register...
Python
from django.conf.urls.defaults import * import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^pinkewang/', include('pinkewang.foo.urls')), # Uncomment the admin/doc line below and add 'django.c...
Python
from django.db import models # Create your models here.
Python