code
stringlengths
1
1.72M
language
stringclasses
1 value
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without res...
Python
# Copyright (c) 2008 Chris Moyer http://coredumped.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2008, Chris Moyer http://coredumped.org # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, m...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, m...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2008 Chris Moyer http://coredumped.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
from boto.mturk.connection import MTurkConnection from boto.mturk.question import ExternalQuestion def test(): q = ExternalQuestion(external_url="http://websort.net/s/F3481C", frame_height=800) conn = MTurkConnection(host='mechanicalturk.sandbox.amazonaws.com') keywords=['boto', 'test', 'doctest'] crea...
Python
import doctest # doctest.testfile("create_hit.doctest") # doctest.testfile("create_hit_binary.doctest") doctest.testfile("create_free_text_question_regex.doctest") # doctest.testfile("create_hit_from_hit_type.doctest") # doctest.testfile("search_hits.doctest") # doctest.testfile("reviewable_hits.doctest")
Python
from boto.mturk.connection import MTurkConnection from boto.mturk.question import ExternalQuestion from boto.mturk.qualification import Qualifications, PercentAssignmentsApprovedRequirement def test(): q = ExternalQuestion(external_url="http://websort.net/s/F3481C", frame_height=800) conn = MTurkConnection(hos...
Python
from boto.mturk.connection import MTurkConnection def cleanup(): """Remove any boto test related HIT's""" conn = MTurkConnection(host='mechanicalturk.sandbox.amazonaws.com') current_page = 1 page_size = 10 total_disabled = 0 ignored = [] while True: # reset the total for this loop...
Python
# Copyright (c) 2010 Spotify AB # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # t...
Python
# Copyright (c) 2010 Spotify AB # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # t...
Python
# Copyright (c) 2010 Spotify AB # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # t...
Python
# Copyright (c) 2010 Spotify AB # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # t...
Python
# Copyright (c) 2010 Spotify AB # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # t...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # Copyright 2010 Google Inc. # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in ...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without res...
Python
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
Python
# Copyright (c) 2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, m...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without res...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, ...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # withou...
Python
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, m...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, m...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # w...
Python
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from google.appengine.ext import webapp from framework.web import Dispatcher import interceptor class Test(unittest.TestCase): def init_get(self, url): self._init_http('GET',...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import time import unittest from framework import gaeunit from framework import cache class Test(gaeunit.GaeTestCase): def test_cache(self): key1 = 'key1' key2 = 'key2' self....
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework import validator class Test(unittest.TestCase): def test_check_email(self): valid_emails = ( 'askxuefeng@gmail.com', 'michael.lia...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Web MVC framework for AppEngine/WebOb. ''' import re import time import urllib import inspect import logging from google.appengine.ext import webapp from framework import ApplicationError from fra...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Validator API. ''' import types import re REGEX_EMAIL = re.compile(r'^[a-z0-9\.\_\-]+\@([a-z0-9\-]+\.){1,3}[a-z]{2,6}$') REGEX_MD5 = re.compile(r'^[a-f0-9]{32}$') def check_email(email): ''' ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework.gaeunit import GaeTestCase from framework import store class Test(GaeTestCase): def test_set_setting(self): name = 'email' value = 'guest@example.com' ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Base test case for Google AppEngine. ''' import os import sys import unittest def _lookup_gae_home(): ''' Return GAE home. Lookup order: 1. Environment variable 'GAE_HOME'. 2. Defaul...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework import encode class Test(unittest.TestCase): def test_encode_html(self): self.assertEquals('abc', encode.encode_html('abc')) self.assertEquals('<h1>...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from google.appengine.ext import db as db from framework.gaeunit import GaeTestCase from framework.store import BaseModel class TestModel(BaseModel): name = db.StringProperty() class...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework.gaeunit import GaeTestCase from framework import store class Test(GaeTestCase): def test_create_comment(self): ref = 'key123456789' email = 'guest@exampl...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest import threading from framework import gaeunit from framework import store class CounterThread(threading.Thread): ''' Test thread for updating counter. ''' def __init__(sel...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework.web import _matches from framework.web import get from framework.web import post from framework.web import raw_mapping @get('/say') def say(): return 'hello' @get('/pr...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import hashlib import unittest from framework.gaeunit import GaeTestCase from framework import ValidationError from framework import store class Test(GaeTestCase): def test_create_and_get_user(self): ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Simple anti-bot API for Google reCaptcha service. ''' import logging import urllib RECAPTCHA_URL = 'http://www.google.com/recaptcha/api/verify' TEST_DOMAIN = 'localhost' TEST_PUB_KEY = '6LeAOr0SAAAAA...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Encoding utils for HTML, XML, JavaScript, etc. ''' def encode_html(str): ''' Encode html. Args: str: string to encode. Returns: str encoded with utf-8. ''' ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' All storage-related class and functions. ''' import datetime import random from google.appengine.ext import db as db from framework import cache from framework import ValidationError from framework ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' View rendering using Cheetah. ''' import os import logging from Cheetah.Template import Template from framework import ApplicationError class RenderError(ApplicationError): ''' Error when...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' class ApplicationError(StandardError): ''' Base error for ExpressMe application. ''' pass class ValidationError(ApplicationError): ''' Validation failed. ''' pass class P...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import unittest from framework.web import Context class Test(unittest.TestCase): def test_context_kw(self): ctx = Context(name='Michael', title='Engineer') self.assertEquals('Michael', ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' import os import unittest from framework import view class Test(unittest.TestCase): def test_get_template_path(self): self.assertTrue(os.path.isfile(view.get_template_path('http_test', 'main'))...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Simple functions to send mail. ''' from google.appengine.api import mail def send(sender_address, to_address, subject, body, html=None): ''' Send mail. Args: sender_address: ...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'Michael Liao (askxuefeng@gmail.com)' ''' Simple functions to make ease of use memcache. ''' from google.appengine.api import memcache as memcache def set(key, value, time=0): ''' Put the value into cache for a given key. Arg...
Python
#!/usr/bin/env python # Build CJK Font Package, in tar.bz2 for format import sys, os, tarfile, time, re, stat file_map = { } INFO_FILE_NAME = "_FONTINFO" LIST_FILE_NAME = "_FILELIST" PKG_FILE_EXT = "fpkg" EXTRA_INFO_FILE_NAME = "_EXTRAINFO" file_patterns = { "uni%FONT%[0-9a-fA-F]{2,4}\.(tfm|vf|pfb)": "#1-UTF8",\...
Python
#!/usr/bin/env python # Build CJK Font Package, in tar.bz2 for format import sys, os, tarfile, time, re, stat file_map = { } INFO_FILE_NAME = "_FONTINFO" LIST_FILE_NAME = "_FILELIST" PKG_FILE_EXT = "fpkg" EXTRA_INFO_FILE_NAME = "_EXTRAINFO" file_patterns = { "uni%FONT%[0-9a-fA-F]{2,4}\.(tfm|vf|pfb)": "#1-UTF8",\...
Python
# -*- coding: utf-8 -*- """ TreeFileBrowser a tree-like gtk file browser Copyright (C) 2006-2008 Adolfo González Blázquez <code@infinicode.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either...
Python
#!/usr/bin/env python #-*- coding: UTF-8 -*- import gobject import gtk import os import gio import urllib import gconf import rb,rhythmdb import treefilebrowser import logging,logging.handlers log=logging.getLogger('FolderView') LAST_PATH_KEY = '/rhythmbox.plugin.FolderView.lastpath' class FolderViewSource(rb.Browse...
Python