Skip to content

Instantly share code, notes, and snippets.

Avatar

Burak Arslan plq

View GitHub Profile
@plq
plq / output
Created Jun 18, 2011
Foreign keys in object mixins
View output
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 Jun 26, 2011
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.
View dbmail_to_dovecot.py
#!/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 Sep 26, 2011
django wrapper for rpclib
View django.py
# 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 Oct 28, 2011
email date inconsistency
View test_email_date.py
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 Oct 28, 2011
sqlalchemy infinite recursion problem.
View README
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 Jan 10, 2012
Qt ile encoding testi.
View encoding.cpp
#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 Apr 3, 2012
Any tag test case.
View any_type_test.py
#!/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
Using rpclib with wsdl containing namespaced messages
View badcalc.wsdl
<?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>
View client.py
#!/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 Aug 10, 2012
Namespace Issue
View authn.py
# 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
You can’t perform that action at this time.