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 sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, ForeignKey, create_engine | |
from sqlalchemy.orm import sessionmaker, relationship | |
from sqlalchemy.orm.collections import attribute_mapped_collection | |
Base = declarative_base() | |
class Parent(Base): | |
__tablename__ = 'parents' | |
id = Column(Integer, primary_key=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
#!/usr/bin/python2.7 | |
import path_config | |
from app import db_maker | |
db = db_maker() | |
from models import admin | |
from models.admin.base import AdminFrontModel | |
from sqlalchemy.orm.attributes import manager_of_class |
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 os, sys, warnings | |
def _get_root(): | |
# Only .py file is symbolic link, while compiled module can be placed | |
# locally | |
name, ext = os.path.splitext(__file__) | |
fn = os.path.abspath(name +'.py') | |
if os.path.islink(fn): | |
# Symlinks are relative to target, not working dir | |
fn = os.path.join(os.path.dirname(fn), os.readlink(fn)) |
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 sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, ForeignKey, create_engine | |
from sqlalchemy.orm import sessionmaker, relationship | |
Base = declarative_base() | |
class Parent(Base): | |
__tablename__ = 'parents' | |
id = Column(Integer, primary_key=True) | |
#children = relationship('Child', cascade='all') # doesn't merge |
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 sqlalchemy.orm.query import Query | |
from sqlalchemy.sql import ClauseElement | |
from sqlalchemy import cast, Boolean | |
class PublicQuery(Query): | |
''' | |
Filters all queries by publicity condition for each participating mapped | |
class. Attribute "public" of mapped class (if present) should be either |
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 pdb | |
>>> pdb.set_trace() | |
--Return-- | |
> <stdin>(1)<module>()->None | |
(Pdb) from __future__ import division | |
(Pdb) 1/2 | |
0 | |
(Pdb) from __future__ import division; 1/2 | |
0.5 |
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
<script type='text/javascript'> | |
(function(){ | |
var oh=window.location.host, nh=oh.replace(/\.\w+$/, '.com'); | |
if (nh!=oh) { | |
window.location.replace(window.location.href.replace(oh, nh+'/ncr')); | |
} | |
})() | |
</script> |
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
diff -r df324794a581 -r c59f41d443d3 third-party/webob/response.py | |
--- a/third-party/webob/response.py Wed Oct 24 19:28:50 2012 +0400 | |
+++ b/third-party/webob/response.py Thu Oct 25 16:29:29 2012 +0400 | |
@@ -115,16 +115,11 @@ | |
charset = None | |
if 'charset' in kw: | |
charset = kw.pop('charset') | |
- elif self.default_charset: | |
- if (content_type | |
+ elif (self.default_charset |
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/python | |
from lxml.builder import ElementMaker | |
from lxml import etree | |
class QName(unicode): | |
def __new__(cls, maker, name): | |
self = unicode.__new__(cls, maker._namespace+name) |
NewerOlder