1. James Michael DuPont
  2. the-anti-corruption-pledge

Overview

Code for The Anti Corruption Pledge appengine website.

To run the site locally:

1. Call "localhost:8080/load" first to load the data in "app/load.py"
2. To run tests, call "python tests/run_all_tests.py"
    2.1 You may need to set your local directory path 
        For Mac, add in "run_all_tests.py":
        GAE_HOME = "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/"
        ...
        EXTRA_PATHS = [
            DIR_PATH,
            os.path.join(PROJECT_HOME, 'the-anti-corruption-pledge'),
            os.path.join(PROJECT_HOME, 'the-anti-corruption-pledge', 'app'),
            os.path.join(GAE_HOME, 'google_appengine'),
            os.path.join(GAE_HOME, 'google_appengine', 'lib', 'django'),
            os.path.join(GAE_HOME, 'google_appengine', 'lib', 'webob'),
            os.path.join(GAE_HOME, 'google_appengine', 'lib', 'yaml', 'lib')
        ]
    
Features in this branch : 

1. A combo box of titles (mr, mrs) and when other is selected, you can enter a custom text. Custom text is hidden otherwise. The title is stored in its own field.
2. Supports of entering non standard names in the full name field, or entering in a standard name. Hiding the standard fields if not needed.
3. Support of csv export in an admin interface.
3.1 Support of parsing and splitting old full_name data in the csv export routine.
4. Support of a test frame for testing code without running the full server.
5. Error handling if the secure hash is not know.
6. Support of the local test server and the url generated uses the local server name.
7. refactored the javascript code to use jquery and not the old dom interface.
8. moved the google graph code into a separate base class so it is not loaded for no reason


Install :    
        
        sudo apt-get install python-setuptools
        sudo pip-2.7   install --upgrade setuptools
        sudo pip-2.7   install --upgrade django


Upgrade to 2.7, read these links :

* https://developers.google.com/appengine/docs/python/python25/migrate27
* https://developers.google.com/appengine/docs/python/tools/webapp/utilmodule#run_wsgi_app
* https://developers.google.com/appengine/docs/python/tools/webapp2
* http://webapp-improved.appspot.com/tutorials/gettingstarted/templates.html
* http://webapp-improved.appspot.com/features.html
* https://developers.google.com/appengine/docs/python/tools/uploadingdata#Setting_Up_remote_api

Added security for export :
* https://developers.google.com/appengine/docs/python/config/appconfig


HandlC
Create a blob for the output :
* http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/file.py?r=155
* http://stackoverflow.com/questions/10236363/storing-filtered-images-on-the-blobstore-in-gae
* http://stackoverflow.com/questions/2151472/google-appengine-and-python-exceptions
* http://stackoverflow.com/questions/5697844/how-to-set-filename-property-in-blobstore
* http://stackoverflow.com/questions/8958187/replacing-a-blobstore-file
* http://stackoverflow.com/questions/9210731/what-is-the-proper-way-to-write-to-the-google-app-engine-blobstore-as-a-file-in
* https://developers.google.com/appengine/docs/python/blobstore/
* https://developers.google.com/appengine/docs/python/blobstore/blobinfoclass
* https://developers.google.com/appengine/docs/python/blobstore/functions
* https://developers.google.com/appengine/docs/python/blobstore/overview
* https://developers.google.com/appengine/docs/python/googlestorage/functions#open
* https://developers.google.com/appengine/docs/python/images/functions
* https://developers.google.com/appengine/docs/python/tools/webapp/blobstorehandlers

We create a blob for the results and don't stream it. 

* http://stackoverflow.com/questions/5697844/how-to-set-filename-property-in-blobstore

when we do all the files at ones FileNotOpenedError :
so we Create 50 Files on the server, 
* http://code.google.com/p/googleappengine/issues/detail?id=5731
http://stackoverflow.com/questions/8201283/google-app-engine-how-to-write-large-files-to-google-cloud-storage
* http://stackoverflow.com/questions/11514264/filenotopenederror-with-cloud-storage-on-gae
* http://stackoverflow.com/questions/9266187/error-filenotopenederror


I then use this command to download all the data :
  wget -r -d 1 "http://3.theanticorruptionpledge.appspot.com/export/list"
  tar -czf data.tgz 3.theanticorruptionpledge.appspot.com/