pyramid/bodhi/bodhi/__init__.py | 22 +++++++++++-----------
pyramid/bodhi/bodhi/models/models.py | 1 +
pyramid/bodhi/bodhi/resources.py | 24 +++++++++++-------------
3 files changed, 23 insertions(+), 24 deletions(-)
New commits:
commit 7b6c8c7c5fb0693fed3e384d90730077f3da6709
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sat May 14 14:02:15 2011 -0400
Exclude the Release.metrics column from JSON
diff --git a/pyramid/bodhi/bodhi/models/models.py b/pyramid/bodhi/bodhi/models/models.py
index 0cefdf0..b09148b 100644
--- a/pyramid/bodhi/bodhi/models/models.py
+++ b/pyramid/bodhi/bodhi/models/models.py
@@ -115,6 +115,7 @@ bug_cve_table = Table('bug_cve_table', metadata,
class Release(Base):
__tablename__ = 'releases'
+ __exclude_columns__ = ('metrics')
id = Column(Integer, primary_key=True)
name = Column(Unicode(10), unique=True, nullable=False)
commit f0065b5584620d9a3af36cdd78f6236e08030c7a
Author: Luke Macken <lmacken(a)redhat.com>
Date: Sat May 14 14:02:00 2011 -0400
Minor cleanups
diff --git a/pyramid/bodhi/bodhi/__init__.py b/pyramid/bodhi/bodhi/__init__.py
index 2f0099f..923ad53 100644
--- a/pyramid/bodhi/bodhi/__init__.py
+++ b/pyramid/bodhi/bodhi/__init__.py
@@ -7,17 +7,17 @@ from pyramid.config import Configurator
from bodhi.resources import appmaker
-class BodhiRequest(Request):
- @reify
- def user(self):
- # <your database connection, however you get it, the below line
- # is just an example>
- dbconn = self.registry.settings['dbconn']
- userid = unauthenticated_userid(self)
- if userid is not None:
- # this should return None if the user doesn't exist
- # in the database
- return dbconn['users'].query({'id':userid})
+#class BodhiRequest(Request):
+# @reify
+# def user(self):
+# # <your database connection, however you get it, the below line
+# # is just an example>
+# dbconn = self.registry.settings['dbconn']
+# userid = unauthenticated_userid(self)
+# if userid is not None:
+# # this should return None if the user doesn't exist
+# # in the database
+# return dbconn['users'].query({'id':userid})
def main(global_config, **settings):
diff --git a/pyramid/bodhi/bodhi/resources.py b/pyramid/bodhi/bodhi/resources.py
index 7839bf6..ac73d62 100644
--- a/pyramid/bodhi/bodhi/resources.py
+++ b/pyramid/bodhi/bodhi/resources.py
@@ -28,24 +28,22 @@ class BodhiResource(object):
def __getitem__(self, key):
session = DBSession()
- log.debug('%s(%r)'% (self.__class__.__name__, key))
try:
return session.query(self.__model__).filter_by(**{self.__column__:
key}).one()
except NoResultFound:
- log.debug('NoResultsFound')
raise KeyError(key)
- def get(self, key, default=None):
- try:
- item = self.__getitem__(key)
- except KeyError:
- item = default
- return item
-
- def __iter__(self):
- session = DBSession()
- query = session.query(self.__model__)
- return iter(query)
+ #def get(self, key, default=None):
+ # try:
+ # item = self.__getitem__(key)
+ # except KeyError:
+ # item = default
+ # return item
+
+ #def __iter__(self):
+ # session = DBSession()
+ # query = session.query(self.__model__)
+ # return iter(query)
class PackageResource(BodhiResource):
Show replies by date