Mercurial > kallithea
annotate rhodecode/model/meta.py @ 1757:2aa7f454204e beta
fixes #298, ldap email addresses created by rhodecode automatically during first login didn't get converted to lower case, which lead to lookup failures and than wrong checks for uniqueness. Fixed that by putting a setter on db model column that will enforce converting to lowercase.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 06 Dec 2011 01:18:27 +0200 |
parents | cac5109ac3b6 |
children | 6c86c987cf93 |
rev | line source |
---|---|
0 | 1 """SQLAlchemy Metadata and Session object""" |
2 from sqlalchemy.ext.declarative import declarative_base | |
1388
2029c17cc6c6
Added basic JsonSerialization into models.
Marcin Kuzminski <marcin@python-works.com>
parents:
1271
diff
changeset
|
3 from sqlalchemy.orm import scoped_session, sessionmaker |
1065
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
4 from beaker import cache |
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
5 |
1669
f522f4d3bf93
moved caching query to libs
Marcin Kuzminski <marcin@python-works.com>
parents:
1388
diff
changeset
|
6 from rhodecode.lib import caching_query |
1065
5d676b6ab71c
Moved BaseModel into base class for declarative base. Added some handy methods into
Marcin Kuzminski <marcin@python-works.com>
parents:
612
diff
changeset
|
7 |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
8 |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
9 # Beaker CacheManager. A home base for cache configurations. |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
10 cache_manager = cache.CacheManager() |
0 | 11 |
12 __all__ = ['Base', 'Session'] | |
13 # | |
14 # SQLAlchemy session manager. Updated by model.init_model() | |
15 # | |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
16 Session = scoped_session( |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
17 sessionmaker( |
1712
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1669
diff
changeset
|
18 query_cls = caching_query.query_callable(cache_manager), |
cac5109ac3b6
Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents:
1669
diff
changeset
|
19 expire_on_commit = True, |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
20 ) |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
21 ) |
0 | 22 |
23 # The declarative Base | |
1388
2029c17cc6c6
Added basic JsonSerialization into models.
Marcin Kuzminski <marcin@python-works.com>
parents:
1271
diff
changeset
|
24 Base = declarative_base() |
482
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
25 |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
26 #to use cache use this in query |
7afbc45aab28
added caching queries to hg-app
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
27 #.options(FromCache("sqlalchemy_cache_type", "cachekey")) |