def main(): up = os.path.dirname webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(webkit_root, "Tools", "Scripts"), "webkitpy") # There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it. if not (sys.platform.startswith("win") or sys.platform == "cygwin"): tester.add_tree(os.path.join(webkit_root, "Source", "WebKit2", "Scripts"), "webkit2") tester.skip(("webkitpy.common.checkout.scm.scm_unittest",), "are really, really, slow", 31818) if sys.platform.startswith("win"): tester.skip( ("webkitpy.common.checkout", "webkitpy.common.config", "webkitpy.tool"), "fail horribly on win32", 54526 ) # This only needs to run on Unix, so don't worry about win32 for now. appengine_sdk_path = "/usr/local/google_appengine" if os.path.exists(appengine_sdk_path): if not appengine_sdk_path in sys.path: sys.path.append(appengine_sdk_path) import dev_appserver from google.appengine.dist import use_library use_library("django", "1.2") dev_appserver.fix_sys_path() tester.add_tree(os.path.join(webkit_root, "Tools", "QueueStatusServer")) else: _log.info("Skipping QueueStatusServer tests; the Google AppEngine Python SDK is not installed.") return not tester.run()
def __django_version_setup(): """Selects a particular Django version to load.""" django_version = _config_handle.django_version if django_version is not None: from google.appengine.dist import use_library use_library("django", str(django_version)) else: from google.appengine.dist import _library version, explicit = _library.installed.get("django", ("0.96", False)) if not explicit: logging.warn( "You are using the default Django version (%s). " "The default Django version will change in an " "App Engine release in the near future. " "Please call use_library() to explicitly select a " "Django version. " "For more information see %s", version, "https://developers.google.com/appengine/docs/python/tools/" "libraries#Django", ) try: import django if not hasattr(django, "VERSION"): from django import v0_96 except ImportError: pass
def __django_version_setup(): """Selects a particular Django version to load.""" django_version = _config_handle.django_version if django_version is not None: from google.appengine.dist import use_library use_library('django', str(django_version)) else: from google.appengine.dist import _library version, explicit = _library.installed.get('django', ('0.96', False)) if not explicit: logging.warn('You are using the default Django version (%s). ' 'The default Django version will change in an ' 'App Engine release in the near future. ' 'Please call use_library() to explicitly select a ' 'Django version. ' 'For more information see %s', version, 'https://developers.google.com/appengine/docs/python/tools/' 'libraries#Django') try: import django if not hasattr(django, 'VERSION'): from django import v0_96 except ImportError: pass
def pypath(): """ Setup the environment and python path for django and for dev_appserver. """ os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # Set up the python path using dev_appserver for path in os.environ.get('PATH').split(os.pathsep): if 'dev_appserver.py' in os.listdir(path): test_path = os.path.join(path, 'dev_appserver.py') sdk_path = os.path.dirname(os.readlink(test_path) if os.path.islink(test_path) else test_path) sys.path.insert(0, sdk_path) from dev_appserver import fix_sys_path from google.appengine import tools, dist # Load config from app.yaml appinfo, _, _ = tools.dev_appserver.LoadAppConfig( os.path.normpath(os.path.abspath('.')) {}, default_partition='dev') fix_sys_path() # Add Django (and any libraries) defined in app.yaml if appinfo.libraries: for library in appinfo.libraries: dist.use_library(library.name, library.version)
def main(): up = os.path.dirname webkit_root = up(up(up(up(up(os.path.abspath(__file__)))))) tester = Tester() tester.add_tree(os.path.join(webkit_root, 'Tools', 'Scripts'), 'webkitpy') tester.add_tree(os.path.join(webkit_root, 'Source', 'WebKit2', 'Scripts'), 'webkit2') tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818) if sys.platform == 'win32': tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526) # This only needs to run on Unix, so don't worry about win32 for now. appengine_sdk_path = '/usr/local/google_appengine' if os.path.exists(appengine_sdk_path): if not appengine_sdk_path in sys.path: sys.path.append(appengine_sdk_path) import dev_appserver from google.appengine.dist import use_library use_library('django', '1.2') dev_appserver.fix_sys_path() tester.add_tree(os.path.join(webkit_root, 'Tools', 'QueueStatusServer')) else: _log.info('Skipping QueueStatusServer tests; the Google AppEngine Python SDK is not installed.') return not tester.run()
def _runserver(self): import sys from google.appengine.tools import dev_appserver_main from google.appengine.tools import dev_appserver_import_hook print dev_appserver_import_hook.FakeFile.NOT_ALLOWED_DIRS root = '/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/' sys.path.append(root) sys.path.append(root + "lib/antlr3/") sys.path.append(root + "lib/cacerts/") sys.path.append(root + "lib/ipaddr/") sys.path.append(root + "lib/graphy/") sys.path.append(root + "lib/ipaddr/") sys.path.append(root + "lib/protorpc/") sys.path.append(root + "lib/simplejson/") sys.path.append(root + "lib/webapp2/") sys.path.append(root + "lib/webob/") sys.path.append(root + "lib/yaml/lib/") # sys.path.append(root + "lib/whoosh/") from google.appengine.dist import use_library use_library('django', '1.2') try: for task in self.pre_tasks: task.run() except Exception, e: logging.error(e) sys.exit(1)
def LoadDjango(version=None): global have_django_zip from google.appengine.dist import use_library from google.appengine.dist._library import UnacceptableVersionError # Must set this env var *before* importing any more of Django. os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # If we have set a version explicitly, force that if version: use_library('django', version) return if os.path.exists(django_zip_path): have_django_zip = True sys.path.insert(1, django_zip_path) # Remove the standard version of Django if a local copy has been provided. if have_django_zip or os.path.exists(os.path.join(PARENT_DIR, 'django')): for k in [k for k in sys.modules if k.startswith('django')]: del sys.modules[k] return # If we aren't loading from a zip or local copy then try for whichever # supported version is highest and installed for check_version in ('1.2', '1.1', '1.0'): try: use_library('django', check_version) return except UnacceptableVersionError: pass raise UnacceptableVersionError()
def main(sdk_path, test_path): # Get the appserver on the path. sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() # Copy datastore to new file. shutil.copyfile(TEST_DATASTORE, TEST_DATASTORE + "_tmp") # Set up datastore so we can test on meaningful data. t = testbed.Testbed() t.setup_env(True, application_id='dev~openmobiledata') t.activate() t.init_datastore_v3_stub(True, TEST_DATASTORE + "_tmp", False) t.init_memcache_stub() # Get correct Django version. from google.appengine.dist import use_library use_library('django', '1.2') suite = unittest2.loader.TestLoader().discover(test_path, pattern='*_test.py') unittest2.TextTestRunner(verbosity=2).run(suite) t.deactivate()
def setup_environ(): # lib sys.path.insert(0, os.path.join(ROOT_PATH, 'lib')) # SDK (this will be simpler if SDK is in the codebase) sdk_path = None for path in os.environ.get('PATH').split(os.pathsep): if 'dev_appserver.py' in os.listdir(path): test_path = os.path.join(path, 'dev_appserver.py') sdk_path = os.path.dirname( os.readlink(test_path) if \ os.path.islink(test_path) else test_path) break if not sdk_path: sys.stderr.write("Fatal: Can't find sdk_path") sys.exit(1) sys.path.insert(0, sdk_path) # Use dev_appserver to set up the python path from dev_appserver import fix_sys_path fix_sys_path() from google.appengine.tools import dev_appserver as tools_dev_appserver from google.appengine import dist # Parse `app.yaml` appinfo, url_matcher, from_cache = tools_dev_appserver.LoadAppConfig( ROOT_PATH, {}, default_partition='dev') app_id = appinfo.application # Useful for later scripts os.environ['APPLICATION_ID'] = app_id os.environ['APPLICATION_VERSION'] = appinfo.version # Third party libraries on the path if appinfo.libraries: for library in appinfo.libraries: try: dist.use_library(library.name, library.version) except ValueError, e: if library.name == 'django' and library.version == '1.4': # Work around an SDK issue print 'Warning: django 1.4 not recognised by dist, fixing python path' sys.path.insert(0, os.path.join(sdk_path, 'lib', 'django-1.4')) else: print 'Warning: Unsupported library:\n%s\n' % e # Extra setup for django if library.name == 'django': try: import settings from django.core.management import setup_environ setup_environ(settings, original_settings_path='settings') except ImportError: sys.stderr.write("\nWarning! Could not import django settings")
def output_json(mydic): import sys from google.appengine.dist import use_library use_library('django', '0.96') from django.utils import simplejson print 'Content-type: text/x-json\n\n' print simplejson.dumps(mydic,ensure_ascii = False) sys.exit(1)
def main(sdk_path, test_path): sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() from google.appengine.dist import use_library use_library('django', '1.2') suite = unittest.loader.TestLoader().discover(test_path) unittest.TextTestRunner(verbosity=2).run(suite)
def setDjango(): """Sets Django version used by the application.""" # TODO(daniel): this should be removed at some point as Interactive Shell # does not use Django. This is currently required, because when main module # is loaded, it always imports gae_django module which requires Django # version to be set. This should be changed so that it is loaded only # for Prod/Dev server. os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine import dist dist.use_library('django', '1.2')
def setup_django(settings='settings', version='1.3', ): """ Sets up the django libraries. :param settings: The name of the settings file. Default: ``'settings'``. :param version: The django version to set up. Default: ``'1.3'``. """ import os os.environ['DJANGO_SETTINGS_MODULE'] = settings from google.appengine.dist import use_library use_library('django', version) from django.conf import settings _ = settings.TEMPLATE_DIRS
def main(sdk_path, test_path): # Get the appserver on the path sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() # Get correct Django version from google.appengine.dist import use_library use_library('django', '1.2') suite = unittest2.loader.TestLoader().discover(test_path, pattern='*_test.py') unittest2.TextTestRunner(verbosity=2).run(suite)
def bootstrap_django(): # Declare the Django version we need. from google.appengine.dist import use_library use_library('django', '1.1') # Fail early if we can't import Django 1.x. Log identifying information. import django logging.info('django.__file__ = %r, django.VERSION = %r', django.__file__, django.VERSION) assert django.VERSION[0] >= 1, "This Django version is too old" # Custom Django configuration. os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.conf import settings settings._target = None
def setup_test_env(sdk_path): """Sets up App Engine/Django test environment.""" sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() # google.appengine.ext.testbed.Testbed should set SERVER_SOFTWARE # and APPLICATION_ID environment variables, but we need them # earlier when Django import settings.py. os.environ['SERVER_SOFTWARE'] = 'DevTestrunner' # used in settings.py os.environ['APPLICATION_ID'] = 'test-codereview' # used in settings.py os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '1.2')
def main(): os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' use_library('django', '0.96') application = webapp.WSGIApplication([ ('/', MainHandler), ('/create', CreateHandler), ('/finish', FinishHandler), ('/calendar', CalendarHandler), ('/purge', PurgeHandler) ] , debug=True) util.run_wsgi_app(application)
def setup(): # setup django environ os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '1.2') # force Django to reload its settings. from django.conf import settings settings._target = None def log_exception(*args, **kwds): logging.exception('Exception in request:') logging.basicConfig(level=logging.DEBUG)
def setup_test_env(sdk_path): """Sets up App Engine/Django test environment.""" sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) sys.path.insert(0, sdk_path) import dev_appserver dev_appserver.fix_sys_path() # google.appengine.ext.testbed.Testbed should set SERVER_SOFTWARE # and APPLICATION_ID environment variables, but we need them # earlier when Django import settings.py. os.environ['SERVER_SOFTWARE'] = 'DevTestrunner' # used in settings.py os.environ['APPLICATION_ID'] = 'test-codereview' # used in settings.py os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' # Provide a dummy value for REQUEST_ID_HASH in environment. This is # needed for now to make appstats happy (see comments on # http://codereview.appspot.com/5305060/). os.environ['REQUEST_ID_HASH'] = 'testing' from google.appengine.dist import use_library use_library('django', '1.2')
def init_gae(**opts): from google.appengine.dist import use_library use_library('django', '0.96') from google.appengine.tools import dev_appserver from google.appengine.tools.dev_appserver_main import \ DEFAULT_ARGS, ARG_CLEAR_DATASTORE, \ ARG_DATASTORE_PATH, ARG_HISTORY_PATH # start GAE! gae_opts = DEFAULT_ARGS.copy() gae_opts[ARG_CLEAR_DATASTORE] = True gae_opts[ARG_DATASTORE_PATH] = os.path.join(tempfile.gettempdir(), 'nosegae.datastore') gae_opts[ARG_HISTORY_PATH] = os.path.join(tempfile.gettempdir(), 'gae.datastore.history') gae_opts.update(opts) config, _junk = dev_appserver.LoadAppConfig(os.curdir, {}) dev_appserver.SetupStubs(config.application, **gae_opts)
def setup(): # setup django environ os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '1.1') # force Django to reload its settings. from django.conf import settings settings._target = None #from django.core import signals #from django import db def log_exception(*args, **kwds): logging.exception('Exception in request:') #signals.Signal.connect(log_exception, signals.got_request_exception) #signals.Signal.disconnect(db._rollback_on_exception, # signals.got_request_exception) logging.basicConfig(level=logging.DEBUG)
def main(): filesystem = FileSystem() wkf = WebKitFinder(filesystem) tester = Tester(filesystem, wkf) tester.add_tree(wkf.path_from_webkit_base('Tools', 'Scripts'), 'webkitpy') tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818) if sys.platform == 'win32': tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool', 'webkitpy.w3c', 'webkitpy.layout_tests.layout_package.bot_test_expectations'), 'fail horribly on win32', 54526) # This only needs to run on Unix, so don't worry about win32 for now. appengine_sdk_path = '/usr/local/google_appengine' if os.path.exists(appengine_sdk_path): if not appengine_sdk_path in sys.path: sys.path.append(appengine_sdk_path) import dev_appserver from google.appengine.dist import use_library use_library('django', '1.2') dev_appserver.fix_sys_path() tester.add_tree(wkf.path_from_webkit_base('Tools', 'TestResultServer')) else: _log.info('Skipping TestResultServer tests; the Google AppEngine Python SDK is not installed.') return not tester.run()
#Copyright (c) 2012, www.directionalstar.com #See the file LICENSE.txt for copying permission. import os import re import datetime import logging from google.appengine.dist import use_library use_library('django', '1.2') from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext.webapp import template from google.appengine.api import users from google.appengine.ext import db import models import handler class UserLogout(handler.Handler): def get(self): user = self.checkUser() if user: self.redirect( users.create_logout_url(self.request.headers.get('Referer'))) return
def main(): use_library('django', '0.96') run_wsgi_app(application)
from google.appengine.dist import use_library use_library('django', "1.0") import os,sys import logging #Standard Imports from google.appengine.ext import webapp from appcode.dataserver import * from appengine_utilities.sessions import Session from django.shortcuts import render_to_response from django.utils import simplejson from django.core.urlresolvers import reverse from django.shortcuts import HttpResponse import appcode.sohosecurity as sohosecurity import about.helpers import message.helpers import entity.helpers import appcode.sohosecurity class SohoResponseSession(): def __init__(self): self.session = Session() def __getitem__(self, keyname): try: session_val_test = self.session[keyname] except KeyError:
# Bloggart is currently based on Django 0.96 import os os.environ["DJANGO_SETTINGS_MODULE"] = "settings" from google.appengine.dist import use_library use_library("django", "0.96") import logging import wsgiref.handlers from google.appengine.ext.webapp import template from google.appengine.ext import webapp from google.appengine.api import memcache # Fix sys.path import fix_path fix_path.fix_sys_path() import config import jsmin import cssmin """ Request Handler for Minified CSS This allows to apply Templating and Minification to CSS Stylesheets. """ class CssMinifier(webapp.RequestHandler):
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """DrJson app configuration file.""" __author__ = '[email protected] (Eric Higgins)' from google.appengine import dist dist.use_library('django', '1.1') import django assert django.VERSION[0] >= 1, 'This Django version is too old' import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.conf import settings settings._target = None DEBUG = False URL_CACHE_TIME = 86400 # 1 day, in seconds. # Django settings. TIME_ZONE = 'UTC' DATE_FORMAT = 'N j, Y' # e.g. Feb. 4, 2010.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Request a modern Django from google.appengine.dist import use_library use_library("django", "1.2") # Must agree with __init.py__ from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from handlers.activebots import ActiveBots from handlers.gc import GC from handlers.nextpatch import NextPatch from handlers.patch import Patch from handlers.patchstatus import PatchStatus from handlers.processingtimesjson import ProcessingTimesJSON from handlers.queuecharts import QueueCharts from handlers.queuelengthjson import QueueLengthJSON from handlers.queuestatus import QueueStatus from handlers.queuestatusjson import QueueStatusJSON from handlers.recentstatus import QueuesOverview
from google.appengine.dist import use_library use_library("django", "1.2") from google.appengine.ext import webapp from google.appengine.ext.webapp import util, template from google.appengine.runtime.apiproxy_errors import CapabilityDisabledError, OverQuotaError import os, urllib, re class UploadHandler(webapp.RequestHandler): def post(self): try: body = self.request.body; filename = re.search(r".*filename=\"(.*)\.(.*)\"", body) mime = re.search(".*Content-Type: (.*)/(.*)\\r\\n", body) if(filename != None and mime != None): filename = filename.groups()[0] mimetype = mime.groups()[0] +"/"+ mime.groups()[1] mime = mime.groups()[0] blob = self.request.get("file") if (mime == "audio"): if(len(blob) < 512000): blob64 = blob.encode('base64') blob64 = blob64.replace('\n', '') values = { 'name' : filename,
# distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import logging import os # Must set this env var before importing any part of Django # 'project' is the name of the project created with django-admin.py os.environ["DJANGO_SETTINGS_MODULE"] = "settings" from google.appengine.dist import use_library use_library("django", "1.1") import sys sys.path.insert(0, "./contrib") # Google App Engine imports. from google.appengine.ext.webapp import util # Force Django to reload its settings. from django.conf import settings settings._target = None import django.core.handlers.wsgi import django.core.signals
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Handle the weekly snippet digest emails.""" __author__ = '[email protected] (Eric Higgins)' import datetime import logging import os os.environ['DJANGO_SETTINGS_MODULE'] = 'appengine_config' from google.appengine import dist # pylint: disable-msg=C6204 dist.use_library('django', '1.1') from google.appengine.api import mail # pylint: disable-msg=C6204 from google.appengine.api import memcache from google.appengine.api import users from google.appengine.api.labs import taskqueue from google.appengine.ext import deferred from google.appengine.ext import ereporter from google.appengine.ext import webapp from google.appengine.ext.webapp import util as webapputil from google.appengine.runtime import DeadlineExceededError import models import pytz import util ereporter.register_logger()
def _django_setup(): """Imports and configures Django. This can be overridden by defining a function named webapp_django_setup() in the app's appengine_config.py file (see lib_config docs). Such a function should import and configure Django. You can also just configure the Django version to be used by setting webapp_django_version in that file. Finally, calling use_library('django', <version>) in that file should also work, followed by code to configure Django settings: # The first two sections of this example are taken from # http://code.google.com/appengine/docs/python/tools/libraries.html#Django import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '1.1') # This last section is necessary to be able to switch between # Django and webapp.template freely, regardless of which was # imported first. from django.conf import settings settings._target = None If your application also imports Django directly it should ensure that the same code is executed before your app imports Django (directly or indirectly). Perhaps the simplest way to ensure that is to include the following in your main.py (and in each alternate main script): from google.appengine.ext.webapp import template import django This will ensure that whatever Django setup code you have included in appengine_config.py is executed, as a side effect of importing the webapp.template module. """ django_version = _config_handle.django_version if django_version is not None: from google.appengine.dist import use_library use_library('django', str(django_version)) else: from google.appengine.dist import _library version, explicit = _library.installed.get('django', ('0.96', False)) if not explicit: logging.warn( 'You are using the default Django version (%s). ' 'The default Django version will change in an ' 'App Engine release in the near future. ' 'Please call use_library() to explicitly select a ' 'Django version. ' 'For more information see %s', version, 'http://code.google.com/appengine/docs/python/tools/' 'libraries.html#Django') try: from django import v0_96 except ImportError: pass import django import django.conf try: django.conf.settings.configure( DEBUG=False, TEMPLATE_DEBUG=False, TEMPLATE_LOADERS=( 'django.template.loaders.filesystem.load_template_source', ), ) except (EnvironmentError, RuntimeError): pass
from google.appengine.ext import webapp from google.appengine.ext import db from google.appengine.ext.db import polymodel from google.appengine.api import urlfetch from google.appengine.api import memcache from google.appengine.api.labs import taskqueue import cgi from google.appengine.ext.webapp.util import run_wsgi_app # from http://code.google.com/appengine/docs/python/tools/libraries.html#Django # import os #done earlier os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '0.96') #import pickle # for listoflist in datastore from django.utils import simplejson ### some variables like header, footer etc. from temp_global import * # truncating html via http://stackoverflow.com/questions/4970426/html-truncating-in-python import re def truncate_html_words(s, num): """ Truncates html to a certain number of words (not counting tags and comments). Closes opened tags if they were correctly closed in the given html.
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Request a modern Django from google.appengine.dist import use_library use_library('django', '1.2') # Must agree with __init.py__ from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from handlers.activebots import ActiveBots from handlers.fetchattachment import FetchAttachment from handlers.gc import GC from handlers.nextpatch import NextPatch from handlers.patch import Patch from handlers.patchstatus import PatchStatus from handlers.processingtimesjson import ProcessingTimesJSON from handlers.queuecharts import QueueCharts from handlers.queuelengthjson import QueueLengthJSON from handlers.queuestatus import QueueStatus from handlers.queuestatusjson import QueueStatusJSON
''' Created on May 23, 2011 @author: Antonio Bello - Elapsus ''' # ------------ # Ensure this block is at beginning of file import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library use_library('django', '1.2') # End block # ------------ import wsgiref from google.appengine.ext import webapp from view.client_view import AddClientHandler, ListClientsHandler, ClientAsync from view.invoice_view import CreateInvoiceHandler, InvoiceAsync,\ ListInvoicesHandler from flexy.utils.rendering import render_template from flexy.web.handler.base_handler import REGEX_URL_PARAM class MainHandler(webapp.RequestHandler): def get(self): if not render_template(self, self.request.path):
# encoding=utf-8 import logging import os import re from google.appengine.dist import use_library use_library('django', '0.96') from django.utils import simplejson from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp import template import issues import model DEFAULT_ACTION = 'table' def parse_labels(labels): labels = list(set(re.split('[, ]+', labels))) return sorted([l for l in labels if l]) class Action: def __init__(self, rh): self.rh = rh def render(self, data): self.rh.render(self.template, data)