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
Day job: | |
Django/Plone/Pyramid developer | |
Favorite Python project: | |
Pyramid | |
Favorite Conference: | |
Plone Conf 2010 | |
Python Experience Level: |
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_macros python:path('here/%s/macros|nothing' % view_template); |
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 django.core.management.commands.runserver import BaseRunserverCommand | |
from django.conf import settings | |
from dozer import Profiler | |
class Command(BaseRunserverCommand): | |
def get_handler(self, *args, **options): | |
""" | |
Returns the normal handler wrapped in a warm Dozer embrace. | |
""" |
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 | |
""" | |
Copyright 2011 Domen Kozar. All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are | |
permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this list of | |
conditions and the following disclaimer. |
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
""" | |
Sample specific search query to airbnb returning list of new flats (compared to last run) as stdout (meant to be used as crontab). | |
Copyright 2011 Domen Kozar. All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, are | |
permitted provided that the following conditions are met: | |
1. Redistributions of source code must retain the above copyright notice, this list of | |
conditions and the following disclaimer. |
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 string | |
from sqlalchemy.engine.reflection import Inspector | |
class LowerCaseInspector(Inspector): | |
"""Implements reflection inspector that reflects everything lowercase""" | |
def get_table_names(self, *a, **kw): | |
tables = super(LowerCaseInspector, self).get_table_names(*a, **kw) |
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 deform | |
import colander | |
class TestSchema(colander.MappingSchema): | |
list = colander.SchemaNode(colander.Integer(), | |
widget=deform.widget.SelectWidget(values=[(1, 'one'), (2, 'two')])) | |
class Test2Schema(colander.MappingSchema): | |
list = colander.SchemaNode(colander.Integer(), |
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
> []+{} | |
"[object Object]" | |
> {}+[] | |
0 |
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 datetime | |
import icalendar | |
import pytz | |
tz = pytz.timezone('Europe/Ljubljana') | |
dt = datetime.datetime(2012, 10, 23, 14, 0, 0) | |
print "datetime without timezone information: ", dt | |
dt_localized = tz.localize(dt) | |
print "localized into DST Europe/Ljubljana: ", dt_localized |
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
############################################################################## | |
# | |
# Copyright (c) 2006 Zope Corporation and Contributors. | |
# All Rights Reserved. | |
# | |
# This software is subject to the provisions of the Zope Public License, | |
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | |
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | |
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
OlderNewer