Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
hypothesis/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
robertknight/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
Choose a Head Repository
hypothesis/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
robertknight/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
  • 4 commits
  • 5 files changed
  • 1 commit comment
  • 1 contributor
Commits on Feb 26, 2015
Configure pyramid_basemodel in h.notification
In the API application, h.notification is included at pyramid boot time,
while h.accounts is not. This means that when the
h.notifications.Subscriptions model tries to query the database, it
explodes because there is no active session.

This change makes it possible to load h.notification and h.account in
either order.
Enable h.notification in the API application
The h.notification package contains subscribers for
h.events.AnnotationEvent, which send reply notification emails when new
replies are created.

Because the API is now an isolated WSGI application, it does not share a
registry with the main application. As such, we need to explicitly
include the notification package in the API application so that its
subscribers are correctly called when annotations are created through
the API.

This restores email notification functionality broken by 29c1500.
Showing with 23 additions and 27 deletions.
  1. +0 −10 h/__init__.py
  2. +15 −1 h/app.py
  3. +8 −1 h/notification/models.py
  4. +0 −3 h/notification/reply_template.py
  5. +0 −12 h/notification/test/reply_template_test.py
View
@@ -7,13 +7,3 @@
del get_versions
__all__ = ['main']
def includeme(config):
"""Include config sections and setup Jinja."""
config.include('.views')
config.include('pyramid_jinja2')
config.add_jinja2_renderer('.js')
config.add_jinja2_renderer('.txt')
config.add_jinja2_renderer('.html')
View
@@ -37,8 +37,13 @@ def create_app(settings):
config.add_subscriber('h.subscribers.add_renderer_globals',
'pyramid.events.BeforeRender')
config.include('.')
config.include('.features')
config.include('.views')
config.include('pyramid_jinja2')
config.add_jinja2_renderer('.js')
config.add_jinja2_renderer('.txt')
config.add_jinja2_renderer('.html')
if config.registry.feature('accounts'):
config.include('.accounts')
@@ -80,6 +85,15 @@ def create_api(settings):
if config.registry.feature('streamer'):
config.include('.streamer')
if config.registry.feature('notification'):
config.include('pyramid_jinja2')
config.add_jinja2_renderer('.txt')
config.add_jinja2_renderer('.html')
# FIXME: move subscribers into .notification.subscribers so we don't
# have to include the whole package
config.include('.notification')
return config.make_wsgi_app()
View
@@ -4,9 +4,11 @@
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy import func, and_
from pyramid_basemodel import Base
from hem.db import get_session
from hem.interfaces import IDBSession
from horus.models import BaseModel
from pyramid_basemodel import Base
from pyramid_basemodel import Session
log = logging.getLogger(__name__)
@@ -69,4 +71,9 @@ class Subscriptions(SubscriptionsMixin, Base):
def includeme(config):
registry = config.registry
if not registry.queryUtility(IDBSession):
registry.registerUtility(Session, IDBSession)
config.scan(__name__)
@@ -30,9 +30,6 @@
def parent_values(annotation):
if 'references' in annotation:
parent = Annotation.fetch(annotation['references'][-1])
if 'references' in parent:
grandparent = Annotation.fetch(parent['references'][-1])
parent['quote'] = grandparent['text']
return parent
else:
return {}
@@ -85,7 +85,6 @@ def test_parent_values_reply():
parent = rt.parent_values(annotation)
assert parent['id'] == '0'
assert 'quote' not in parent
def test_parent_values_root_annotation():
@@ -98,17 +97,6 @@ def test_parent_values_root_annotation():
assert len(parent.items()) == 0
def test_parent_values_second_level_reply():
"""Test if it the grandparent values are filled for a second level reply"""
with patch('h.notification.reply_template.Annotation') as mock_annotation:
mock_annotation.fetch = MagicMock(side_effect=fake_fetch)
annotation = store_fake_data[2]
parent = rt.parent_values(annotation)
assert parent['id'] == '1'
assert parent['quote'] == store_fake_data[0]['text']
# Tests for the create_template_map function
def test_all_keys_are_there():
"""Checks for the existence of every needed key for the template"""

Showing you all comments on commits in this comparison.

@tilgovi

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Feb 26, 2015

Contributor

\o/

Contributor

tilgovi commented on 1585203 Feb 26, 2015

\o/