This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We are assuming EL5 (<EL5 is not supported), since we don't have EL6 python27 packages yet. | |
%define __python_pkgname python27 | |
%define __python_exe python2.7 | |
# Override the global %{__python} macro to point to our own python version | |
%define __python %{_bindir}/%{__python_exe} | |
# Specify the distribute package to use | |
%define setuptools_package python27-distribute | |
# This is the "package name" that we use in naming the /etc, /var/run, /var/log, subdirs. | |
%define PACKAGE sideboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import os | |
import re | |
import shutil | |
import warnings | |
from ConfigParser import SafeConfigParser, NoOptionError | |
import pkg_resources | |
from paver.path import path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from common import * | |
import constants | |
from custom_tags import time_day | |
uninvited = [] # redacted for public gist | |
val2name = {} | |
for _name, _val in constants.__dict__.items(): | |
if re.match('^[_A-Z0-9]+$', _name) and isinstance(_val, int): | |
val2name[_val] = _name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sep 22 10:20:19 prime 2014-09-22 10:20:19,244 [ERROR] cherrypy.error.140059498634376: [22/Sep/2014:10:20:19] HTTP Traceback (most recent call last): | |
File "/usr/local/uber13/env/lib/python3.4/site-packages/SQLAlchemy-0.8.5-py3.4.egg/sqlalchemy/engine/base.py", line 867, in _execute_context | |
context) | |
File "/usr/local/uber13/env/lib/python3.4/site-packages/SQLAlchemy-0.8.5-py3.4.egg/sqlalchemy/engine/default.py", line 326, in do_execute | |
cursor.execute(statement, parameters) | |
psycopg2.DataError: invalid input syntax for uuid: "None" | |
LINE 3: WHERE "group".id = 'None' | |
^ | |
The above exception was the direct cause of the following exception: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'admin_email': 'Eli Courtwright <eli@courtwright.org>', | |
'age_groups': {'age_unknown': {'can_register': True, | |
'can_volunteer': True, | |
'consent_form': False, | |
'desc': 'age unknown', | |
'discount': 0, | |
'wristband_color': ''}, | |
'over_21': {'can_register': True, | |
'can_volunteer': True, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path = "/uber" | |
hostname = "50.56.242.7" | |
url_root = "http://50.56.242.7:8282" | |
dev_box = True | |
send_emails = False | |
collect_exact_birthdate = True | |
event_name = "MAGStock" | |
organization_name = "MAGStock" | |
groups_enabled = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Current version: | |
def csv_file(func): | |
@wraps(func) | |
def csvout(self, session): | |
cherrypy.response.headers['Content-Type'] = 'application/csv' | |
cherrypy.response.headers['Content-Disposition'] = 'attachment; filename=' + func.__name__ + '.csv' | |
writer = StringIO() | |
func(self, csv.writer(writer), session) | |
return writer.getvalue().encode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My main problem with Perl is references and contexts. Most of the experienced programmers I've worked with find themselves unable to write or debug code that requires the use of these Perl concepts. | |
For example, my co-workers and I find it easy and intuitive to work with lists in Python: | |
xs = [5, 6] | |
xs.append(7) | |
print xs[2] # prints 7 | |
xs.append([]) # easy to append lists to other lists | |
xs[3].append(6) # easy to append to the inner list | |
some_func(12, "hello", xs, True) # easy to pass to a function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
To use Flask with Sideboard, make a plugin and then put this file in the plugin | |
module's directory, e.g. sideboard/plugins/paper_bag/paper_bag/__init__.py and | |
the Flask site will be available at https://localhost:4443/uber/paper_bag | |
""" | |
import cherrypy | |
from cherrypy import wsgiserver | |
from flask import Flask | |
app = Flask(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cherrypy | |
class Root(object): | |
@cherrypy.expose | |
def index(self): | |
raise cherrypy.HTTPRedirect('/') | |
if __name__ == '__main__': | |
cherrypy.quickstart(Root()) |
OlderNewer