Skip to content

Instantly share code, notes, and snippets.

View plq's full-sized avatar

Burak Arslan plq

View GitHub Profile
@plq
plq / output
Created June 18, 2011 13:34
Foreign keys in object mixins
Traceback (most recent call last):
File "sqla_mixin.py", line 45, in <module>
DeclarativeBase.metadata.create_all(engine)
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/schema.py", line 2415, in create_all
tables=tables)
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2178, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/engine/base.py", line 1857, in _run_visitor
**kwargs).traverse_single(element)
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 86, in traverse_single
@plq
plq / dbmail_to_dovecot.py
Created June 26, 2011 18:27
This is a script to migrate a dbmail 2.2.x mail store to a maildir store with dovecot extensions. Preserves imap and pop3 uids.
#!/usr/bin/python -tt
#
# Migration script from dbmail 2.2.x message store to a maildir message store
# with dovecot extensions.
#
# Tested with dbmail-2.2.17 -> dovecot-2.0.13 on postgresql-9.0.4
# and sqlalchemy-0.7.1.
#
@plq
plq / django.py
Created September 26, 2011 17:11
django wrapper for rpclib
# This is not yet included in main rpclib distribution because
# it does a lot of unnecessary copying. However, it's reportedly
# working fine, so if you're not caring that much about performance
# you can use this.
from rpclib.server.wsgi import WsgiApplication
from cStringIO import StringIO
from django.http import HttpResponse
@plq
plq / test_email_date.py
Created October 28, 2011 09:55
email date inconsistency
import pytz
import email.utils
import time
from datetime import datetime
a = datetime.now(pytz.utc)
print email.utils.formatdate(time.mktime(a.timetuple()))
print email.utils.formatdate(time.mktime(a.utctimetuple()) - time.timezone + 1e-6 * a.microsecond)
@plq
plq / README
Created October 28, 2011 16:05
sqlalchemy infinite recursion problem.
to get this example running:
1) mysql -u root -p < localhost.sql
2) edit connection string in main_server.py
3) run main_server.py
4) run ws_client.py, witness infinite recursion
@plq
plq / encoding.cpp
Created January 10, 2012 10:14
Qt ile encoding testi.
#include <QString>
#include <QTextCodec>
#include <iostream>
int main(int argc, char *argv[]) {
const char *p = "kıracağım";
// Kaynak kod editörünün encoding'inin utf8 olduğunu varsayarsak;
QTextCodec *utf8 = QTextCodec::codecForName("utf8");
QTextCodec *cp_1254 = QTextCodec::codecForName("Windows-1254");
@plq
plq / any_type_test.py
Created April 3, 2012 14:24
Any tag test case.
#!/usr/bin/env python
from lxml import etree
from rpclib.model.primitive import AnyXml
from rpclib.model.complex import ComplexModel
from rpclib.const import xml_ns as ns
from rpclib.util.xml import get_schema_documents
class SomeType(ComplexModel):
@plq
plq / badcalc.wsdl
Created May 17, 2012 12:58
Using rpclib with wsdl containing namespaced messages
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:calc="http://www.example.com/wsdl/calc/v1.0"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/wsdl/calc/v1.0"
name="CalcWebService">
<wsdl:types>
@plq
plq / client.py
Created July 13, 2012 11:33
jussi_test
#!/usr/bin/env python
from suds.client import Client
client = Client("http://localhost:9753/?wsdl")
print client.service.TestService("x")
@plq
plq / authn.py
Created August 10, 2012 08:26
Namespace Issue
# This file is one copy from https://github.com/arskom/spyne/blob/master/examples/authentication/server_soap.py
import sys
import random
import logging
from spyne.model.complex import ComplexModel
from spyne.model.fault import Fault
from spyne.decorator import srpc
from spyne.error import ArgumentError
from spyne.protocol.soap import Soap11