Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul committed Mar 25, 2012
0 parents commit 1f3769f
Show file tree
Hide file tree
Showing 2,603 changed files with 129,419 additions and 0 deletions.
Binary file added .gaedata/datastore
Binary file not shown.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>betting</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
37 changes: 37 additions & 0 deletions .pydevproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>

<pydev_project>
<pydev_variables_property name="org.python.pydev.PROJECT_VARIABLE_SUBSTITUTION">
<key>GOOGLE_APP_ENGINE</key>
<value>C:\Program Files (x86)\Google\google_appengine</value>
</pydev_variables_property>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/betting</path>
</pydev_pathproperty>
<pydev_pathproperty name="org.python.pydev.PROJECT_EXTERNAL_SOURCE_PATH">
<path>${GOOGLE_APP_ENGINE}</path>
<path>${GOOGLE_APP_ENGINE}/lib/antlr3</path>
<path>${GOOGLE_APP_ENGINE}/lib/django_1_3</path>
<path>${GOOGLE_APP_ENGINE}/lib/enum</path>
<path>${GOOGLE_APP_ENGINE}/lib/fancy_urllib</path>
<path>${GOOGLE_APP_ENGINE}/lib/google-api-python-client</path>
<path>${GOOGLE_APP_ENGINE}/lib/graphy</path>
<path>${GOOGLE_APP_ENGINE}/lib/grizzled</path>
<path>${GOOGLE_APP_ENGINE}/lib/httplib2</path>
<path>${GOOGLE_APP_ENGINE}/lib/ipaddr</path>
<path>${GOOGLE_APP_ENGINE}/lib/jinja2</path>
<path>${GOOGLE_APP_ENGINE}/lib/markupsafe</path>
<path>${GOOGLE_APP_ENGINE}/lib/oauth2</path>
<path>${GOOGLE_APP_ENGINE}/lib/prettytable</path>
<path>${GOOGLE_APP_ENGINE}/lib/protorpc</path>
<path>${GOOGLE_APP_ENGINE}/lib/python-gflags/tests</path>
<path>${GOOGLE_APP_ENGINE}/lib/simplejson</path>
<path>${GOOGLE_APP_ENGINE}/lib/sqlcmd</path>
<path>${GOOGLE_APP_ENGINE}/lib/webapp2</path>
<path>${GOOGLE_APP_ENGINE}/lib/webob</path>
<path>${GOOGLE_APP_ENGINE}/lib/yaml/lib</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
</pydev_project>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//open_facebook/api.py=utf-8
Empty file added __init__.py
Empty file.
Binary file added __init__.pyc
Binary file not shown.
34 changes: 34 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
application: iplbetter
version: 1
runtime: python27
api_version: 1
threadsafe: yes

builtins:
- remote_api: on

inbound_services:
- warmup

libraries:
- name: django
version: latest

handlers:
- url: /_ah/queue/deferred
script: djangoappengine.deferred.handler.application
login: admin

- url: /_ah/stats/.*
script: djangoappengine.appstats.application

- url: /media/admin
static_dir: django/contrib/admin/media
expiration: '0'

- url: /static/
static_dir: static_files
expiration: '0'

- url: /.*
script: djangoappengine.main.application
20 changes: 20 additions & 0 deletions autoload/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def autodiscover(module_name):
"""
Automatically loads modules specified by module_name for each app in
installed apps.
"""
from django.conf import settings
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule

for app in settings.INSTALLED_APPS:
mod = import_module(app)
# Attempt to import the app's module.
try:
import_module('%s.%s' % (app, module_name))
except:
# Decide whether to bubble up this error. If the app just
# doesn't have an module, we can ignore the error
# attempting to import it, otherwise we want it to bubble up.
if module_has_submodule(mod, module_name):
raise
Binary file added autoload/__init__.pyc
Binary file not shown.
14 changes: 14 additions & 0 deletions autoload/middleware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.utils.importlib import import_module
from django.conf import settings

# load all models.py to ensure signal handling installation or index loading
# of some apps
for app in settings.INSTALLED_APPS:
try:
import_module('%s.models' % (app))
except ImportError:
pass

class AutoloadMiddleware(object):
"""Empty because the import above already does everything for us"""
pass
Binary file added autoload/middleware.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions autoload/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Load the siteconf module
from django.conf import settings
from django.utils.importlib import import_module
SITECONF_MODULE = getattr(settings, 'AUTOLOAD_SITECONF', settings.ROOT_URLCONF)
import_module(SITECONF_MODULE)
Binary file added autoload/models.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cron:
10 changes: 10 additions & 0 deletions dbindexer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def autodiscover():
from autoload import autodiscover as auto_discover
auto_discover('dbindexes')

def load_indexes():
from django.conf import settings
from django.utils.importlib import import_module

for name in getattr(settings, 'DB_INDEX_MODULES', ()):
import_module(name)
Binary file added dbindexer/__init__.pyc
Binary file not shown.
27 changes: 27 additions & 0 deletions dbindexer/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .lookups import LookupDoesNotExist, ExtraFieldLookup
from . import lookups as lookups_module
from .resolver import resolver
import inspect

# TODO: add possibility to add lookup modules
def create_lookup(lookup_def):
for _, cls in inspect.getmembers(lookups_module):
if inspect.isclass(cls) and issubclass(cls, ExtraFieldLookup) and \
cls.matches_lookup_def(lookup_def):
return cls()
raise LookupDoesNotExist('No Lookup found for %s .' % lookup_def)

def register_index(model, mapping):
for field_name, lookups in mapping.items():
if not isinstance(lookups, (list, tuple)):
lookups = (lookups, )

# create indexes and add model and field_name to lookups
# create ExtraFieldLookup instances on the fly if needed
for lookup in lookups:
lookup_def = None
if not isinstance(lookup, ExtraFieldLookup):
lookup_def = lookup
lookup = create_lookup(lookup_def)
lookup.contribute(model, field_name, lookup_def)
resolver.create_index(lookup)
Binary file added dbindexer/api.pyc
Binary file not shown.
Loading

0 comments on commit 1f3769f

Please sign in to comment.