From 6f5a507abf045b4e32bb03d31c59352ccdb03e50 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jan 18 2018 12:25:07 +0000 Subject: update sample data and default widgets This updates and refreshes the sample data generated by populate.py so it both suits the new FAS world order, and makes the data a little more realish Also, updated the user default widgets to remove a bunch that either are now not available on user hubs, or soon will not be. --- diff --git a/hubs/defaults.py b/hubs/defaults.py index a6bf8b8..991a222 100644 --- a/hubs/defaults.py +++ b/hubs/defaults.py @@ -24,55 +24,18 @@ def add_user_widgets(hub): hub.widgets.append(widget) widget = hubs.models.Widget( - plugin='meetings', index=-1, - _config=json.dumps({ - 'calendar': 'Fedora release', - 'n_meetings': 4, - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget( - plugin='workflow.updates2stable', index=1, - _config=json.dumps({ - 'username': hub.name, - })) - hub.widgets.append(widget) - widget = hubs.models.Widget( plugin='my_hubs', index=3, _config=json.dumps({ })) hub.widgets.append(widget) + widget = hubs.models.Widget( plugin='badges', index=4, _config=json.dumps({ 'username': hub.name, })) hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='pagure_pr', index=5, - _config=json.dumps({ - 'repo': 'pagure', - })) - hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='github_pr', index=7, - _config=json.dumps({ - 'organization': 'fedora-infra', - 'display_number': 15, - })) - hub.widgets.append(widget) - widget = hubs.models.Widget( - plugin='bugzilla', index=8, - _config=json.dumps({ - 'username': hub.name, - })) - hub.widgets.append(widget) - hub.widgets.append( - hubs.models.Widget( - plugin='halp', index=9, - _config=json.dumps({ - })) - ) + return hub diff --git a/populate.py b/populate.py index 8582997..4b7c21d 100755 --- a/populate.py +++ b/populate.py @@ -1,10 +1,9 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """ Populate the hubs db with some dev data. """ from __future__ import unicode_literals -import json - import hubs.app import hubs.database import hubs.models @@ -24,56 +23,101 @@ hubs.widgets.registry.register_list([ "hubs.widgets.meetings:Meetings", "hubs.widgets.about:About", "hubs.widgets.feed:Feed", + "hubs.widgets.memberships:Memberships", ]) + def create_users(): - users = ['mrichard', 'duffy', 'ryanlerch', 'gnokii', 'nask0', - 'abompard', 'decause', 'ralph', 'lmacken', 'croberts', 'mattdm', - 'pravins', 'keekri', 'linuxmodder', 'bee2502', 'jflory7'] - for username in users: - fullname = 'Full Name Goes Here' + users = {'mrichard': { + 'fullname': 'mrichard', + 'description': 'This is a description for mrichard'}, + 'duffy': { + 'fullname': 'Máirín Duffy', + 'description': 'You can call me Mo. I am a principal ' + 'interaction designer with Red Hat Inc.' + 'and come from a varied background - ' + 'Computer Science, Human Computer Interaction, and' + 'Visual Design'}, + 'ryanlerch': + {'fullname': 'Ryan Lerch'}, + 'gnokii': + {'fullname': 'Sirko Kemter'}, + 'nask0': + {'fullname': 'Atanas Beloborodov'}, + 'abompard': + {'fullname': 'Aurélien Bompard'}, + 'decause': + {'fullname': 'Remy DeCausemaker '}, + 'ralph': + {'fullname': 'Ralph Bean'}, + 'lmacken': + {'fullname': 'Luke Macken'}, + 'croberts': + {'fullname': 'Chris Roberts'}, + 'mattdm': + {'fullname': 'Matthew Miller'}, + 'sayanchowdhury': + {'fullname': 'Sayan Chowdhury'}, + 'pravins': + {'fullname': 'Pravin Satpute'}, + 'keekri': + {'fullname': 'Keerthana Krishnan', + 'description': 'Hello, I\'m Keerthana, and I\'m a student at ' + 'the Govt. Model Engineering College, Thrikkakara, Ernakulam,' + 'Kerala, India. I am majoring in Computer Science and ' + 'Engineering and intend to graduate in 2016. I have been ' + 'using Linux (and Fedora) since I remember.'}, + 'linuxmodder': + {'fullname': 'Corey Sheldon '}, + 'bee2502': + {'fullname': 'Bhagyashree'}, + 'jflory7': + {'fullname': 'Justin W. Flory'}, + 'robyduck': + {'fullname': 'Robert Mayr'} + } + for username, details in users.items(): + fullname = details["fullname"] print("Creating account for %r" % username) hubs.models.User.get_or_create( username=username, fullname=fullname) - db.commit() + db.commit() + if 'description' in details: + userhub = hubs.models.Hub.by_name(username, "user") + userhub.config.update(dict( + description=details["description"] + )) + def create_teams(): -# ############# Internationalizationteam - hub = hubs.models.Hub(name='i18n', hub_type="team") + # Ambassadors + hub = hubs.models.Hub(name='ambassadors', hub_type="team") db.add(hub) hub.config.update(dict( - summary='The Internationalization Team', + summary='Fedora Ambassadors', avatar=placekitten, - archived=True, description=( - 'The Fedora I18N project works on internationalization (i18n)' - 'to support the localization (l10n) of Fedora in many languages.' - 'Translation of Fedora software and documentation are handled by' - 'the Fedora L10N project.'), - rules_url='https://fedoraproject.org/wiki/I18N', + 'Ambassadors are the representatives of Fedora. Ambassadors ' + 'ensure the public understand Fedora\'s principles and the ' + 'work that Fedora is doing. Additionally Ambassadors are ' + 'responsible for helping to grow the contributor base, and ' + 'to act as a liaison between other FLOSS projects and the ' + 'Fedora community.'), + rules_url='https://fedoraproject.org/wiki/Ambassadors', + calendar='ambassadors', + chat_domain="irc.freenode.net", + chat_channel="#fedora-ambassadors", + mailing_list="ambassadors@lists.fedoraproject.org" )) - - widget = hubs.models.Widget(plugin='meetings', index=1, - _config=json.dumps({'calendar': 'i18n'})) + widget = hubs.models.Widget(plugin='memberships', index=1) hub.widgets.append(widget) -# Added a hubs about widget - widget = hubs.models.Widget( - plugin='about', index=3, _config=json.dumps({ - "text": "I'm a Fedora user, and this is my about widget text!", - })) + widget = hubs.models.Widget(plugin='meetings', index=2) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) - -# Set up some memberships - hub.subscribe(hubs.models.User.by_username('pravins'), 'owner') - hub.subscribe(hubs.models.User.by_username('decause'), 'member') - hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber') - - db.commit() # ############# CommOps @@ -81,163 +125,112 @@ def create_teams(): db.add(hub) hub.config["summary"] = 'The Fedora Community Operations Team' hub.config["chat_domain"] = 'irc.freenode.net' - hub.config["chat_channel"] = '#fedora-hubs' - hub.config["pagure"] = 'fedora-hubs' + hub.config["chat_channel"] = '#fedora-commops' + hub.config["pagure"] = 'fedora-commops' hub.config["calendar"] = 'commops' hub.config["description"] = ( "Bringing more heat and light to Fedora, so you don't " "have to choose between 'building things' and 'building communities " "that build things'." ) + hub.config["mailing_list"] = 'commops@lists.fedoraproject.org' hub.config["rules_url"] = 'https://fedoraproject.org/wiki/CommOps' - widget = hubs.models.Widget( - plugin='meetings', index=1, _config=json.dumps({ - 'calendar': 'commops', 'n_meetings': 4 - })) + widget = hubs.models.Widget(plugin='memberships', index=1) hub.widgets.append(widget) -# Added a hubs about widget - widget = hubs.models.Widget(plugin='about', index=3, - _config=json.dumps({ - "text": "Community + Operations = CommOps", - })) + widget = hubs.models.Widget(plugin='meetings', index=2) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) - -# Set up some memberships - hub.subscribe(hubs.models.User.by_username('decause'), 'owner') - hub.subscribe(hubs.models.User.by_username('jflory7'), 'member') - hub.subscribe(hubs.models.User.by_username('bee2502'), 'member') - hub.subscribe(hubs.models.User.by_username('keekri'), 'member') - hub.subscribe(hubs.models.User.by_username('linuxmodder'), 'member') - - db.commit() # ############# Marketing team hub = hubs.models.Hub(name='marketing', hub_type="team") db.add(hub) hub.config["summary"] = 'The Fedora Marketing Team' - hub.config["description"] = """ - The Fedora Marketing Team develops and executes marketing strategies to promote - the usage and support of Fedora worldwide. Through the development of processes - and content, this project aims to support the efforts of other Fedora projects - to spread Fedora and to provide a central repository of ideas and information - that can be used to deliver Fedora to new audiences. We work closely with the - Fedora Ambassadors who spread the word about Fedora at events and allow the - Fedora Project to interact directly with its existing and prospective users. - """ + hub.config["description"] = '' + 'The Fedora Marketing Team develops and executes marketing strategies to' + ' promote the usage and support of Fedora worldwide. Through the' + ' development of processes and content, this project aims to support' + ' the efforts of other Fedora projects to spread Fedora and to provide a' + ' central repository of ideas and information that can be used to deliver' + ' Fedora to new audiences. We work closely with the Fedora Ambassadors who' + ' spread the word about Fedora at events and allow the Fedora Project to' + ' interact directly with its existing and prospective users.' + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Marketing' + hub.config["mailing_list"] = 'marketing@lists.fedoraproject.org' + hub.config["chat_domain"] = 'irc.freenode.net' + hub.config["chat_channel"] = '#fedora-mktg' + hub.config["pagure"] = 'fedora-marketing' + hub.config["calendar"] = 'marketing' - widget = hubs.models.Widget( - plugin='meetings', index=1, _config=json.dumps({ - 'calendar': 'marketing', 'n_meetings': 4 - })) + widget = hubs.models.Widget(plugin='memberships', index=1) hub.widgets.append(widget) -# Added a hubs about widget - widget = hubs.models.Widget( - plugin='about', index=3, _config=json.dumps({ - "text": "I'm a Fedora user, and this is my about widget text!", - })) + widget = hubs.models.Widget(plugin='meetings', index=2) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) - -# Set up some memberships - hub.subscribe(hubs.models.User.by_username('croberts'), 'owner') - hub.subscribe(hubs.models.User.by_username('ryanlerch'), 'owner') - hub.subscribe(hubs.models.User.by_username('mrichard'), 'member') - hub.subscribe(hubs.models.User.by_username('mattdm'), 'member') - hub.subscribe(hubs.models.User.by_username('decause'), 'member') - hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber') - - db.commit() # ############# Design team - hub = hubs.models.Hub(name='design', hub_type="team") + hub = hubs.models.Hub(name='designteam', hub_type="team") db.add(hub) hub.config["summary"] = 'The Fedora Design Team' - hub.config["description"] = """ - The Design Team is the design group of the Fedora project. Our interests are - not only in creating graphics for use by the Fedora community, but also in - advocating the use of the creative tools that are a part of Fedora. - """ + hub.config["description"] = '' + 'The Design Team is the design group of the Fedora project. Our interests ' + 'are not only in creating graphics for use by the Fedora community, but ' + 'also advocating the use of the creative tools that are a part of Fedora.' + hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Design' - hub.config["meetings_text"] = 'Meetings are every other Tuesday at 16:00 UTC' + hub.config["meetings_text"] = 'Meetings are every 2nd Tuesday at 16:00 UTC' + hub.config["mailing_list"] = 'design-team@lists.fedoraproject.org' + hub.config["chat_domain"] = 'irc.freenode.net' + hub.config["chat_channel"] = '#fedora-design' + hub.config["pagure"] = 'design' + hub.config["calendar"] = 'design' - widget = hubs.models.Widget( - plugin='meetings', index=1, _config=json.dumps({ - 'n_meetings': 4 - })) + widget = hubs.models.Widget(plugin='memberships', index=1) hub.widgets.append(widget) -# Added a hubs about widget - widget = hubs.models.Widget( - plugin='about', index=2, _config=json.dumps({ - "text": "I'm a Fedora user, and this is my about widget text!", - })) + widget = hubs.models.Widget(plugin='meetings', index=2) hub.widgets.append(widget) widget = hubs.models.Widget(plugin='feed', index=1, left=True) hub.widgets.append(widget) - -# Set up some memberships - hub.subscribe(hubs.models.User.by_username('duffy'), 'owner') - hub.subscribe(hubs.models.User.by_username('ryanlerch'), 'owner') - hub.subscribe(hubs.models.User.by_username('gnokii'), 'owner') - hub.subscribe(hubs.models.User.by_username('mrichard'), 'owner') - hub.subscribe(hubs.models.User.by_username('nask0'), 'member') - hub.subscribe(hubs.models.User.by_username('decause'), 'member') - hub.subscribe(hubs.models.User.by_username('ralph'), 'subscriber') - db.commit() -# ############# Infra team - hub = hubs.models.Hub(name='infrastructure', hub_type="team") - db.add(hub) - hub.config["summary"] = 'The Fedora Infra Team' - hub.config["description"] = """ - The Infrastructure Team consists of dedicated volunteers and professionals - managing the servers, building the tools and utilities, and creating new - applications to make Fedora development a smoother process. We're located all - over the globe and communicate primarily by IRC and e-mail. - """ - hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Infrastructure' - hub.config["meetings_text"] = 'We meet weekly in #fedora-meeting at 18:00 UTC' - - widget = hubs.models.Widget( - plugin='meetings', index=1, _config=json.dumps({ - 'n_meetings': 4 - })) - hub.widgets.append(widget) - -# Added a hubs about widget - widget = hubs.models.Widget( - plugin='about', index=2, _config=json.dumps({ - "text": "I'm a Fedora user, and this is my about widget text!", - })) - hub.widgets.append(widget) - - widget = hubs.models.Widget(plugin='feed', index=1, left=True) - hub.widgets.append(widget) - - hub.subscribe(hubs.models.User.by_username('ralph'), 'owner') - hub.subscribe(hubs.models.User.by_username('abompard'), 'owner') - hub.subscribe(hubs.models.User.by_username('lmacken'), 'owner') - hub.subscribe(hubs.models.User.by_username('nask0'), 'member') - hub.subscribe(hubs.models.User.by_username('decause'), 'subscriber') - - db.commit() +# ############# Infra team -- commented out, as there is no infra FAS group yet + # hub = hubs.models.Hub(name='infrastructure', hub_type="team") + # db.add(hub) + # hub.config["summary"] = 'The Fedora Infra Team' + # hub.config["description"] = """ + # The Infrastructure Team consists of dedicated volunteers and professional + # managing the servers, building the tools and utilities, and creating new + # applications to make Fedora development a smoother process. We're located + # all over the globe and communicate primarily by IRC and e-mail. + # """ + # hub.config["rules_url"] = 'https://fedoraproject.org/wiki/Infrastructure' + # hub.config["meetings_text"] = 'Weekly in #fedora-meeting at 1800 UTC' + + # widget = hubs.models.Widget( + # plugin='meetings', index=1, _config=json.dumps({ + # 'n_meetings': 4 + # })) + # hub.widgets.append(widget) + + # widget = hubs.models.Widget(plugin='feed', index=1, left=True) + # hub.widgets.append(widget) + + # db.commit() def main():