#190 Fixing the models relationship
Merged by skrzepto. Opened by skrzepto.
skrzepto/fedora-hubs delete-user-fix  into  develop

Download 190.patch

when a hub is deleted, delete the association and also all its widgets are deleted as well.

assumption is that a widget has one hub parent

used this script to verify

#!/usr/bin/env python
""" Delete a hub from the db.
Useful for testing what happens when you recreate them.
"""
import fedmsg.config
fedmsg_config = fedmsg.config.load_config()
import hubs.models
session = hubs.models.init(fedmsg_config['hubs.sqlalchemy.uri'])
hubs_name = raw_input('What hub do you want to delete: ')
print "Looking for hubs %r" % hubs_name
hub = hubs.models.Hub.get(session, hubs_name)
if not hub:
    print "No such hub %r" % hubs_name
else:
    print "Found %r.  Deleting." % hub
    session.delete(hub)
session.commit()

This one might have to be split at 80 characters

One small change, after that :thumbsup: for me

rebased

updated the line and squashed the commits

:thumbsup: for me :)

:thumbsup: :)

Pull-Request has been merged by skrzepto

Metadata