code
stringlengths
1
1.72M
language
stringclasses
1 value
import threading import socket import pickle from communication import * import walker import random import upload class Server(threading.Thread): def __init__(self, pman, fman, port): threading.Thread.__init__(self) self._port = port self._pman = pman self._fman = fman def msg(self, cmd, data=Non...
Python
import os import sys import peermanager import filemanager import pinger import server ##Pretty print peer def out_peer(peer): name, neighbors, ip, port = peer print name + " (" + str(neighbors) + ", " + ip + ":" + str(port) + ")" ##Pretty print peer list def out_list(plist): for peer in plist: out_peer(pee...
Python
import sys def main(amount): res = "nlist" for i in range(amount): i+=1 res += " p"+str(i) res += " -o trial.dot" print res if __name__ == "__main__": main(int(sys.argv[1]))
Python
import gc import subprocess import random import time gc.disable() name = 2 port = 5991 processes = [] for i in range(5): p = subprocess.Popen(['python', 'main.py', 'p'+str(name), str(random.randint(1,10)), str(port)], shell=False, stdin=subprocess.PIPE) p.communicate(input='hello 127.0.0.1:5990')[0] name...
Python
from communication import * class Walker: def __init__(self, ttl, fname, receiverpeer, senderpeer, requester): self._rec_peer = receiverpeer self._sender_peer = senderpeer self._requester = requester self._fname = fname self._ttl = ttl def run(self): name, neighbors, ip, port = self._r...
Python
import os import sys import time import socket import pickle import random import threading class Peer(threading.Thread): ##Initiate the peer. def __init__(self, name, neighbors, port): threading.Thread.__init__(self) self._name = name self._neighbors = neighbors self._p...
Python
import sys import main import time import random import threading class test(threading.Thread): def __init__(self, name, port): threading.Thread.__init__(self) self._name = name self._port = port def run(self): p = main.main("p" + str(self._name), random.randint(1, 10), self._p...
Python
# Mayan Calendar Structure initialization. from mayan_cal import Base # Class and Type initialization. from types import ClassType vars = vars() def instantiate_singletons(): # Instantiate each class in this module that derives from Base, but that is the # intermediate model between Base and the data...
Python
# Copyright 2008 Clint Banis. All rights reserved. Not for reproduction. from mayan_cal import gregarian_date from mayan_cal.affirmation import daily_affirmation, todays_affirmation af = daily_affirmation today = todays_affirmation() class Friend: def __init__(self, year, month, day): self.birt...
Python
#!/usr/local/bin/python INCLUDE_PATH = 'C:\\Documents and Settings\\Clint\\My Documents\\pythonlib' # distutils def setup(): from cx_Freeze import setup, Executable import sys setup(name = "setMayanWallpaper", version = "0.1", description = "Mayan Windows Desktop Wallpaper rend...
Python
# Copyright 2008 Clint Banis. # All rights reserved. # # Draws a daily affirmation picture with tribe and tone glyphs and # affirmation text. # # The Glyph class organizes the operations against folders. # Operations include: # - Generating a wallpaper image for the day. # - Setting t...
Python
#!/bin/python # Copyright 2008 Clint Banis. All rights reserved. # # This script serves as the master module getting the software path right # before importing all sub modules into its namespace. # # The main function is to run the Application ware which implements a # command-line configurable implementation o...
Python
#!/usr/local/bin/python INCLUDE_PATH = 'C:\\Documents and Settings\\Clint\\My Documents\\pythonlib' # distutils def setup(): from cx_Freeze import setup, Executable import sys setup(name = "setMayanWallpaper", version = "0.1", description = "Mayan Windows Desktop Wallpaper rend...
Python
#!/bin/python # Copyright 2008 Clint Banis. All rights reserved. # # This script serves as the master module getting the software path right # before importing all sub modules into its namespace. # # The main function is to run the Application ware which implements a # command-line configurable implementation o...
Python
from mayan_cal import today from mayan_cal.structure import Day from mayan_cal.calculate import get_tribe_tone, get_guiding_power class Template(object): STRING = \ '''I %(TONE_POWER)s in order to %(TRIBE_ACTION)s %(TONE_ACTION_TENSED)s %(TRIBE_ESSENCE)s I seal the %(TIMECELL)s of %(TRIBE_POWER)s With the...
Python
# Standard library requirements. # Note that datetime only supports years back to 1 AD. # Todo: set calendar starting epoch. from pprint import saferepr from datetime import date as gregorian_date # xxx gregOrian from datetime import date as gregarian_date from time import localtime as localnow from time im...
Python
## Windows (TM) Desktop Wallpaper Install. # Copyright 2008 Clint Banis. All rights reserved. # # Built on a Windows XP machine. try: class Windows: # According to http://support.microsoft.com/default.aspx?scid=97142 SPI_SETDESKWALLPAPER = 20 import ctypes # Registry ...
Python
# Galactic Harmonic Module. from mayan_cal import GALACTIC_CONSTANT, NUMERICAL_BASE, HIGHEST_TONE from mayan_cal import gregarian_date, checkGregarianDate from mayan_cal.structure import Tribe, Tone def digit_order(): # Returns a list of digits sorted corresponding to the Tribe numbers. tribes = Tribe.i...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('fbauthfacade.views', (r'graph/(.*)', 'view_graph'), )
Python
from django.utils import simplejson as json from django.http import HttpResponseRedirect, HttpResponse from fbauthfacade import AUTH_CODE, ACCESS_TOKEN from urllib import urlencode, splitquery from cgi import parse_qsl def _get_request_param(request, name): return request.GET[name] def view_graph(reque...
Python
AUTH_CODE = 'the-auth-code' ACCESS_TOKEN = 'abcdefgh'
Python
from html import * class Site: RegisterTemplate('site/base/page.html', DOCTYPE() + HTML(HEAD(TITLE(Block('page_title')), ExternalStylesheet('/style.css')), BODY(DIV(Block('page_detail'), ...
Python
# In-Memory Template Repository & Loader. from django.template import loader, TemplateDoesNotExist _template_repository = dict() # Registration. def RegisterTemplate(name, tmpl): if isinstance(tmpl, basestring): tmpl = TemplateRepresentation(tmpl, name = name) assert isinstance(tmpl, Template...
Python
# Front End. def render(templateString, **values): from django.template import Template, Context return Template(templateString).render(Context(values)) from xml.sax import make_parser from xml.sax.handler import ContentHandler, ErrorHandler, property_lexical_handler from xml.sax.xmlreader import InputS...
Python
# Django Template and HTML Generation. # -- # To know my deed: tis better to not know myself. # Liver of blaspheming Jew. # Thine linen bedsheets of countenance do fear! # Your royal preparation makes us hear something. # from pdb import runcall Absent = object() def traceOff(function): # Do not trace! ...
Python
# HTML Element Construction Library. from html import HTMLElement vars().update(dict((_, HTMLElement(_)) for _ in ['HTML', 'HEAD', 'TITLE', 'SCRIPT', 'LINK', 'META', 'BODY', 'DIV', 'P', 'SPAN', 'HR', 'BR', 'H1', 'H2', 'H3', 'H4', 'H5',...
Python
#!python # Parsing. import re index_pattern = re.compile(r'(?:(?P<vnum>\d+)\.zon)|\$$') def parseindex(index_name): ## return [int(i) for i in ## map(lambda n:index_pattern.match(n).groupdict()['vnum'], ## open(index_name).readlines()) \ ## if type(i) ...
Python
#!python # Parsing. import re index_pattern = re.compile(r'(?:(?P<vnum>\d+)\.zon)|\$$') def parseindex(index_name): ## return [int(i) for i in ## map(lambda n:index_pattern.match(n).groupdict()['vnum'], ## open(index_name).readlines()) \ ## if type(i) ...
Python
from xmlrpclib import ServerProxy, Fault from optparse import OptionParser from config import ServerConfiguration from config import create_download_request class ClientProxy: # Network Model. def __init__(self, address, port = None): self.address = address self.port = port de...
Python
#!python from server import doRunServer from client import doClientCommand def main(argv = None): if argv is None: from sys import argv # Analyze Server or Client Startup Mode. if not doClientCommand(*argv): doRunServer(*argv) if __name__ == '__main__': main()
Python
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler from ConfigParser import ConfigParser, DEFAULTSECT, NoOptionError from cStringIO import StringIO from time import time as now from optparse import OptionParser from xmlrpclib import Fault, loads as loads_xmlrpc, dumps as dumps_xmlrpc ...
Python
# Utility. from compiler import parse as parse_code from random import choice from cStringIO import StringIO from pdb import set_trace as debug from sys import exc_info as getSystemException class Configuration: def __init__(self, **kwd): self.__dict__.update(kwd) class ServerConfiguration(Conf...
Python
from os import spawnl, P_NOWAIT from os import waitpid as waitForProcessExit from signal import signal as installSignalHandler from select import error as SelectError from errno import EINTR, ECHILD def kill(pid): """kill function for Win32""" import win32api handle = win32api.OpenProcess(1, 0...
Python
from os import spawnl, P_NOWAIT, WNOHANG from os import kill as send_signal from os import waitpid as waitForProcessExit from signal import SIGKILL as theKillSignal from signal import SIGSTOP as thePauseSignal from signal import SIGCONT as theResumeSignal from signal import SIGCHLD as theReapSignal from sign...
Python
from os import name as os_platform_name def getNativePlatform(): g = globals() l = locals() module = '%s.%s' % (__name__, os_platform_name) try: return __import__(module, g, l, ['']).NativePlatform except ImportError: # XXX Differentiate between ImportErrors because module doesn't...
Python
#!python from server import doRunServer from client import doClientCommand def main(argv = None): if argv is None: from sys import argv # Analyze Server or Client Startup Mode. if not doClientCommand(*argv): doRunServer(*argv) if __name__ == '__main__': main()
Python
# Storage Management Backend and Interfaces __all__ = ['StorageManagement', 'StorageUnit', 'UserStorage'] import shelve import re from .runtime import * from .architecture import * class StorageManagement(Component): DEFAULT_SHELF_NAME = '.application.db' def __init__(self, application): ...
Python
# Dealing with the Platform/Runtime Core # todo: # break into package: # core.py (Most of these objects) # utility.py (Misc functional routines) # # other platform-related modules # __all__ = ['Object', 'Synthetic', 'breakOn', 'set_trace', 'runcall', 'getSystemException', 'getCur...
Python
# Data Format Encoding __all__ = ['IncreasePackageSize', 'PackageSizeTerminated', 'EncodePackageSize', 'Packager', 'Unpackager', 'Serializable', 'Mapping', 'Compress', 'EntitySpace'] __others__ = ['unpackMessage', 'packMessage', 'unpackMessageSize', 'unpackMessageBuffer', 'enc...
Python
#!python from . import Client, Authorization, Fault, ClientOptions, Synthetic, User, Endpoint from . import printFault, pdb, ApplyCompressionChannel, CompressIfWorthIt # Front End. def openClient(setup, options, ns): if options.support_dir: # Run in 'support mode' assert options.username ...
Python
# Pentacle Client Support (User-Auth-Group) ''' from pentacle.client import support user = support.User('login', 'secret') group = user['~/services'] group.managerConfig(port = 7040) group.serviceConfig('docmgr', partner_name = 'Westmetal Documents', service_api = '@wes...
Python
# Peer Data Client from ..encoding import * from ..runtime import * from ..network import * from ..security import * from ..packaging import * from ..application import * from ..architecture import * import pdb import socket from contextlib import closing as Session DEFAULT_PORT = Application.DEFAULT_POR...
Python
#!python from . import Client, Authorization, Fault, ClientOptions, Synthetic, User, Endpoint from . import printFault, pdb, ApplyCompressionChannel, CompressIfWorthIt # Front End. def openClient(setup, options, ns): if options.support_dir: # Run in 'support mode' assert options.username ...
Python
#!python # Peer Data Client from .encoding import * from .runtime import * from .network import * from .security import * from .packaging import * from .application import * from .architecture import * import pdb import socket from contextlib import closing as Session def DEBUG(*args): pass # print...
Python
# Asyncore-driven Network. __all__ = ['AddNetworkCmdlnOptions', 'HostNetwork', 'Peer', 'AsyncoreControl', 'asyncore', 'socket'] import asyncore import socket import errno from .architecture import * from .packaging import * from .storage import * from .runtime import * from .encoding import * ...
Python
# Package Object Model __all__ = ['Command', 'Response', 'Fault', 'PackageReader', 'NotAvailableError', 'interpretResponse'] from os import SEEK_SET, SEEK_END from .encoding import * from .runtime import * class Command: @classmethod def FromPackage(self, package, entitySpace): ...
Python
#!python # -*- coding: UTF-8 -*- # Service Partner LINE: A Manager Daemon for the Pentacle System Bus # Copyright 2011 Clint Banis & Penobscot Robotics. All rights reserved. # Pronounciation: splīn # from ..application import bootServer, Application from ..architecture import ServiceBase, Event from ..config...
Python
#!python # -*- coding: UTF-8 -*- # Service Partner LINE: A Manager Daemon for the Pentacle System Bus # Copyright 2011 Clint Banis & Penobscot Robotics. All rights reserved. # Pronounciation: splīn # from ..application import bootServer, Application from ..architecture import ServiceBase, Event from ..config...
Python
# Service Manager Components. from ..application import Application from ..security import CalculateDigest, GenerateSecretKey from ..runtime import Object, LookupObject, getCurrentSystemTime, sendSignal, breakOn, contextmanager from ..client import Client, Session from ..network import AsyncoreControl from . im...
Python
from . import Main if __name__ == '__main__': Main()
Python
# Not sure if this should go here: what exactly is it doing? # Managing multiple partners on localhost? # Providing a network interface to start them up on workstations? (that's spline's job) from ...services import PentaclePartner class PartnerCluster(PentaclePartner): @classmethod def FromConfig...
Python
# Client Bus -- Service Partner processes use these routines for backtalk. # Also, non-partner processes can use these routines to access services. from ...application import Application from ...packaging import Fault from ...client import Session, Client, Authorization from ...config import INI from .. import * ...
Python
# Copyright 2011 Clint Banis import os __version__ = 0.1 ServiceManagerName = 'ServiceManager::SplineBus' __all__ = ['__version__', 'ServiceManagerName', 'isRecognizedServer', 'SPLINE_CONFIG_ENV_VAR', 'DEFAULT_SPLINE_CONFIG_FILE', 'PENTACLE_PARTNER_NAME_ENV_VAR', 'PENTACLE_PARTNER_AUTH_E...
Python
# Process Architecture # Todo: # Move into runtime/core # __all__ = ['Engine', 'Event', 'Component', 'Serializable', 'BaseMode', 'SubcommandMode', 'UnboundApiMode', 'ServiceBase'] import Queue from .runtime import * # Event Driver class Engine(Object): def __init__(self, app...
Python
#!python # Front End. from .application import main if __name__ == '__main__': main()
Python
#!python # Peer Data Client from .encoding import * from .runtime import * from .network import * from .security import * from .packaging import * from .application import * from .architecture import * import pdb import socket from contextlib import closing as Session def DEBUG(*args): pass # print...
Python
#!python # Front End. from .application import main if __name__ == '__main__': main()
Python
# Network and Application Config __all__ = ['Configuration'] from ConfigParser import ConfigParser, DEFAULTSECT, NoSectionError, NoOptionError from optparse import OptionParser, Values from os.path import dirname, abspath, normpath import re from .architecture import Component from .runtime import Object, Ne...
Python
# Application __all__ = ['Application', 'ApiManagement'] from code import InteractiveConsole as IC import sys import os from .architecture import * from .network import * from .security import * from .storage import * from .runtime import * from .config import * from . import __version__ as pentacleVer...
Python
# Local debugging. from pdb import set_trace, runcall def breakOn(function): def debugCall(*args, **kwd): set_trace() return function(*args, **kwd) print 'DEBUGGING ON', functionName(function) return debugCall def functionName(function): return '%s.%s' % (getattr(function,...
Python
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('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 t...
Python
#!/usr/bin/env python from django.core.management import execute_manager import imp try: imp.find_module('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 t...
Python
from django.conf.urls.defaults import patterns, include, url from django.conf import settings # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns(settings.PROJECT_MODULE + '.views', # Examples: # url(r'^$', 'dj.views.home', name=...
Python
# Django settings for falcon project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '...
Python
# Management Views. from django.shortcuts import render_to_response from django.template import Template, Context from django.http import HttpResponse from . import getTemplateFile from ....packaging import Fault from datetime import datetime def render_template_response(template_name, **values): temp...
Python
# Django Web Server Implementation. import sys, os from StringIO import StringIO from django.core.management.validation import get_validation_errors from django.core.handlers.wsgi import WSGIHandler from django.conf import settings from django.utils import translation from django.core.servers.basehttp import...
Python
# Spline Web Controller. from ...architecture import ServiceBase from ...runtime import Object, nth, contextmanager from ...client import Authorization, Session from ...bus import ServiceManagerName from ...bus.partners import getManagerOptions from errno import EINTR from types import ClassType as newClas...
Python
# Active System Object Registry & Directory # Builtin Pentacle Service Partner ''' Pentacle Bus Active Database Partner ==================================== This module contains the ActiveRegistry service for a Pentacle database service partner. Use the API Manager to load this service by specifying the class's...
Python
# A task-scheduling implementation. # todo: a more unique name from ..architecture import ServiceBase from ..runtime import nth, Object class CronManager(ServiceBase): NAME = 'System::Cron::Manager' class Task(Object): @classmethod def FromConfig(self, command, schedule): ...
Python
# Westmetal Document Services from pentacle.architecture import ServiceBase from webbrowser import get as getBrowser class DocumentBrowserManager(ServiceBase): NAME = '@westmetal/document/browser' WINDOW = dict(normal = 0, new = 1, tab = 2) def openUrl(self, url, window = 'normal', autoraise = True,...
Python
from ..architecture import ServiceBase, Engine from ..runtime import Synthetic, LookupObject, getCurrentSystemTime, contextmanager, breakOn # (Test) Services. class ClockService(ServiceBase): NAME = 'ClockService::API' def setClockTicking(self, clockTime): self.clockTime = clockTime def g...
Python
# Pentacle O-O P2P # # Copyright (C) 2011 Clint Banis # Author: Clint Banis <cbanis@gmail.com> # URL: <http://www.penobscotrobotics.us> ''' Object-Oriented Peer-to-Peer RPC access library and server application framework. :author: `Clint Banis <gmail.com>`__ :requires: Python 2.6+ :version: 0.2 :group A...
Python
# Security Management __all__ = ['RightsManagement', 'CalculateDigest', 'GenerateSecretKey'] from hmac import HMAC import random from .architecture import * from .storage import * def CalculateDigest(iv, *values): h = HMAC(iv) for v in values: h.update(v) return h.hexdigest() de...
Python
from com import skype from sj.plugin import SkypeJython from sj.utils import parseCmdln, getChatList from sj.utils import examine as MyExamine import sys DefaultOptions = {'topic': 'Jython', 'user_id': '', 'windows': False, 'inspect': False, ...
Python
from com import skype from java.awt import SystemTray from java.awt import Image, Toolkit from java.awt import PopupMenu, MenuItem, TrayIcon from java.awt import AWTException from java.awt.event import ActionListener import sys import re from sj.utils import * from sj.utils import _capture, _count_lines ...
Python
try: True, False except NameError: (True, False) = (1, 0) class JavaStringIO: # XXX IllegalAccessExceptions with StringBuffer?!? puhlease def __init__(self): ## from java.lang import StringBuffer ## self.buffer = StringBuffer() self.buffer = '' def write(self, ...
Python
def pluggable(*functions): for f in functions: f.pluggable = True _outgoing = {} def BUILD(shell, name, operation, data = ''): if operation == 'APPEND': if name in _outgoing: _outgoing[name].append(data) else: _outgoing[name] = [data] def SENDMSG(she...
Python
## /******************************************************************************* ## * Copyright (c) 2006-2007 Koji Hisano <hisano@gmail.com> - UBION Inc. Developer ## * Copyright (c) 2006-2007 UBION Inc. <http://www.ubion.co.jp/> ## * ## * Copyright (c) 2006-2007 Skype Technologies S.A. <http://w...
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 * urlpatterns = patterns('fbauthfacade.views', (r'graph/(.*)', 'view_graph'), (r'login$', 'view_login'), (r'logout$', 'view_logout'), (r'', 'default_view'), )
Python
from django.utils import simplejson as json from django.http import HttpResponseRedirect, HttpResponse from django.http import HttpResponseBadRequest, HttpResponseServerError from urllib import urlencode, splitquery from cgi import parse_qsl from traceback import format_exc import re def _get_request_param...
Python
AUTH_CODE = 'the-auth-code' ACCESS_TOKEN = 'abcdefgh'
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.contrib import admin admin.autodiscover() # from django_site import viewSiteIndex SITE_INDEX = '''<html> <head> <title>Site Index</title> </head> <body> <h2>Site Index</h2> <ul> {% for url in URLS %} <li><a href="{{ url.href ...
Python
# Django settings for django_site project. DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Clint Banis', 'cbanis@gmail.com'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'ancillary.db' # Or path to database file if us...
Python
# Patch for google/appengine/tools/dev_appserver.py def GetLastState(): try: from sys import OldState except ImportError: pass else: return State(OldState[-1]) def RegisterOldState(**state): try: os = sys.OldState except AttributeError: os = sys.OldState = [] state = state.copy() os.appe...
Python
# State Code: def GetOldStates(): import sys try: states = sys.oldStates except AttributeError: states = sys.oldStates = [] return states def RegisterOldState(**kwd): states = GetOldStates() states.insert(0, kwd) def PopOldState(): states = GetOldStates() del ...
Python
# Rename bulkloader progress/result db and its corresponding internal keying. import sqlite3 from sys import stderr from pdb import runcall SIGNATURE_TABLE_NAME = None def get_signature_table_name(): global SIGNATURE_TABLE_NAME try: from google.appengine.tools.bulkloader import SIGNATURE_TABLE_NAME ...
Python
from google.appengine.api.datastore_file_stub import DatastoreFileStub as DFS from google.appengine.datastore import entity_pb from google.appengine.api import datastore_types from google.appengine.api import datastore from pdb import runcall, set_trace as debug from optparse import OptionParser from pickletool...
Python
# Clint Banis Copyright 2010 All rights reserved. # --- # # FB Login auth part based on facebookoauth.py, # with cookie-processing stolen verbatim: # # Facebook: # http://github.com/facebook/python-sdk/blob/master/examples/oauth/facebookoauth.py # http://www.apache.org/licenses/LICENSE-2.0 # from google...
Python
from django.db import models class CharacterClass(models.Model): name = models.CharField(max_length = 30) class Clan(models.Model): pass class Empire(models.Model): pass class Warrior(models.Model): pass class Item(models.Model): pass class Chieftain(models.Model): chclass = models.ForeignKey...
Python
from django.conf.urls.defaults import * from Wartime.wartime.views import SitePages page_pattern = r'^/(?P<player_id>\d+)/(?P<page_name>%s)?$' % '|'.join(SitePages.getAnchors()) urlpatterns = patterns('Wartime.wartime.views', (page_pattern, 'render'), (r'^/create/?...
Python
# Wartime Page Reports. from django.shortcuts import render_to_response from django.template.context import RequestContext from Wartime.wartime.models import Chieftain, CharacterClass, Clan, Empire, Warrior, Item from pdb import set_trace as debug class Page: def __init__(self, name = None, template = None, href...
Python
# Wartime Module. ''' Health: 100/100 More in: <mm:ss> Energy: 10/10 More in: <mm:ss> Stamina: 3/3 More in: <mm:ss> Level: 1 Experience: 9/10 Gold: 2,734 coins (Hoard link to bank) More in <mm:ss> Clan: 1 warriors Empire: 1000 hectares Land: 9860 hectares Home/MainMenu Adventures /quests Th...
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.db import models # Create your models here.
Python
from django.conf.urls.defaults import * urlpatterns = patterns('', (r'^$', 'Wartime.wild.views.view_wild'), (r'media/(?P<path>.*)', 'django.views.static.serve', {'document_root': 'wild/media', 'show_indexes' : False}), )
Python
from django.shortcuts import render_to_response from wild import loadRegion REGION_FILE = 'wild/regions/island.yaml' REGION_FILE = 'H:\My Projects\Wartime\wild\regions\island.yaml') def view_wild(request): region = loadRegion(REGION_FILE) return render_to_response('wild.html', dict(region = region))
Python
# HTML Wilderness. from pdb import set_trace as debug class Wild: BORDERING = False TILING = chr # list def __init__(self, (width, height), tile_base, sprite_base, default_tile, default_start_location = None, **paint): self.tile_base = tile_base self.sprite_bas...
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