- Run the tests in python 2. Did they work? If not, quit this project and do another one.
- Run the tests in python 3. Did they work? If so, you're actually done. This one needs to be marked as "good to go".
- Run python-modernize.
- Run the tests in python 2. Do they work?
- Run the tests in python 3. Do they work?
- If the above fails, you might try running 3to2 which will make a python3-only version. This is acceptable, but less desirable.
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
# -*- coding: utf-8 -*- | |
"""The base Controller API.""" | |
from tg import config | |
from tg import TGController, tmpl_context | |
from tg.render import render | |
from tg import request | |
from tg.i18n import ugettext as _, ungettext |
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
# view | |
@view_config(route_name="user_form", renderer="admin/user.html") | |
def user_form(request): | |
w = widgets.UserForm | |
w.fetch_data(request) | |
mw = tw2.core.core.request_local()['middleware'] | |
mw.controllers.register(w.req(), 'user_submit') | |
return {'widget': w} |
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 pyramid.settings import asbool | |
import tw2.core.core | |
import tw2.jquery | |
def remove_jq_factory(handler, registry): | |
""" In order to use this, you need to add the following you myapp/__init__.py: | |
config.add_tween('myapp.tween.remove_jq_factory') | |
""" |
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
# Files | |
data.location=/home/threebean/.task | |
#include /home/threebean/.task/solarized-dark-256.theme | |
_forcecolor=yes | |
defaultwidth=160 | |
include /usr/local/share/doc/task/rc/dark-violets-256.theme | |
report.work_report.description=now |
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
#!/usr/bin/env python | |
# A simple script that can be used to turn URLs into links | |
# | |
# Using within a pipeline: | |
# | |
# $ echo 'http://lewk.org' | linkify | |
# <a href="http://lewk.org">http://lewk.org</a> | |
# | |
# Using on a file: | |
# |
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
function twd_grow_clone(id_prefix, next_num) | |
{ | |
var clone_node = document.getElementById(id_prefix + '0'); | |
var node = clone_node.cloneNode(true); | |
var stemlen = id_prefix.length + 1; | |
var new_prefix = id_prefix + next_num; | |
var x = twd_get_all_nodes(node); | |
var old_selector = id_prefix.replace(/:/g, '\\\\:') + '0' | |
var new_selector = id_prefix.replace(/:/g, '\\\\:') + next_num; | |
for(var i = 0; i < x.length; i++) |
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 tw2.qrcode | |
my_qrcode = tw2.qrcode.QRCodeWidget( | |
id="demoqr", | |
data="Test text qrcode. This has a lot of data in it.", | |
level=9, | |
width=300, | |
) |
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
#!/usr/bin/env python | |
import github2.client | |
ghc = github2.client.Github() | |
all_repos, page = [], 0 | |
while True: | |
new_repos = ghc.repos.list('toscawidgets', page) | |
if not new_repos: |
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
#!/usr/bin/env python | |
import fabulous.image | |
import urllib | |
prune = "http://www.gourmet.com/images/food/2008/10/foar-prunedanishes608.jpg" | |
fname, wat = urllib.urlretrieve(prune) | |
print fabulous.image.Image(fname) |