Merge lp:~mhall119/ubuntu-community-accomplishments/loco-portal-events-accomplishments into lp:ubuntu-community-accomplishments

Proposed by Michael Hall on 2012-05-31
Status: Merged
Merged at revision: 143
Proposed branch: lp:~mhall119/ubuntu-community-accomplishments/loco-portal-events-accomplishments
Merge into: lp:ubuntu-community-accomplishments
Diff against target: 407 lines (+306/-40)
10 files modified
accomplishments/ubuntu-community/en/advocacy/attend-global-jam.accomplishment (+26/-0)
accomplishments/ubuntu-community/en/advocacy/attend-other-team-event.accomplishment (+21/-0)
accomplishments/ubuntu-community/en/advocacy/attend-ubuntu-hour.accomplishment (+21/-0)
accomplishments/ubuntu-community/en/advocacy/organize-loco-event.accomplishment (+19/-0)
scripts/ubuntu-community/advocacy/attend-global-jam.py (+42/-0)
scripts/ubuntu-community/advocacy/attend-loco-event.py (+4/-40)
scripts/ubuntu-community/advocacy/attend-other-team-event.py (+48/-0)
scripts/ubuntu-community/advocacy/attend-ubuntu-hour.py (+42/-0)
scripts/ubuntu-community/advocacy/organize-loco-event.py (+40/-0)
scripts/ubuntu-community/lib/loco_team_portal.py (+43/-0)
To merge this branch: bzr merge lp:~mhall119/ubuntu-community-accomplishments/loco-portal-events-accomplishments
Reviewer Review Type Date Requested Status
Ubuntu Community Accomplishments Reviewers 2012-05-31 Pending
Review via email: mp+108259@code.launchpad.net

Commit Message

Adds new accomplishments for:
1) Attending a Global Jam event
2) Attending an Ubuntu Hour
3) Attending another team's event
4) Organizing a team event

Description of the Change

Adds new accomplishments for:
1) Attending a Global Jam event
2) Attending an Ubuntu Hour
3) Attending another team's event
4) Organizing a team event

To post a comment you must log in.
145. By Michael Hall on 2012-05-31

Add missing summary for organize-loco-event

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'accomplishments/ubuntu-community/en/advocacy/attend-global-jam.accomplishment'
2--- accomplishments/ubuntu-community/en/advocacy/attend-global-jam.accomplishment 1970-01-01 00:00:00 +0000
3+++ accomplishments/ubuntu-community/en/advocacy/attend-global-jam.accomplishment 2012-05-31 23:45:24 +0000
4@@ -0,0 +1,26 @@
5+[accomplishment]
6+title=Attend Ubuntu Global Jam Event
7+description=You attended a Global Jam with your Local Community
8+collection=ubuntu-community
9+category=LoCo Teams
10+needs-signing=true
11+icon=loco.png
12+depends=ubuntu-community/attend-loco-event
13+needs-information=launchpad-email
14+summary = An Ubuntu Hour is a short, informal meetup every week, every other week or every month.
15+ Ubuntu Hours have become a great method for advocacy, team-building, and social fun. It's a great way to promote the use of Ubuntu on a regular basis.
16+ Organizing and participating in an Ubuntu Hour is very easy:
17+ * Head over to a public place (like a local coffee shop, etc) where you'll hang out.
18+ * Wear something with the Ubuntu logo or have a visible Ubuntu sticker on your laptop (if you bring one).
19+ * When/if you show up, you agree to the Ubuntu Code of Conduct.
20+ * Anyone can start an Ubuntu Hour, anywhere, anytime.
21+ * Remember this is a social event, be approachable!
22+steps: Go to <tt>loco.ubuntu.com</tt> and find your nearest team.
23+ View the list of upcoming events for your team, click on one for the upcoming Global Jam.
24+ Click the 'Register' link on the upper-righthand corner of the page.
25+ Set your registration status to 'attending'.
26+ Attend the event in question and have a great time!
27+links: http://loco.ubuntu.com/events/globaljam/
28+help = #ubuntu-locoteams on Freenode
29+ #ubuntu-community-team on Freenode
30+author = Michael Hall <mhall119@ubuntu.com>
31
32=== added file 'accomplishments/ubuntu-community/en/advocacy/attend-other-team-event.accomplishment'
33--- accomplishments/ubuntu-community/en/advocacy/attend-other-team-event.accomplishment 1970-01-01 00:00:00 +0000
34+++ accomplishments/ubuntu-community/en/advocacy/attend-other-team-event.accomplishment 2012-05-31 23:45:24 +0000
35@@ -0,0 +1,21 @@
36+[accomplishment]
37+title=Attend Event with another Local Community
38+description=You attended an event with a Local Community other than your own
39+collection=ubuntu-community
40+category=LoCo Teams
41+needs-signing=true
42+icon=loco.png
43+depends=ubuntu-community/member-loco-team,ubuntu-community/attend-loco-event
44+needs-information=launchpad-email
45+summary = Local Community Teams aren't isolated, everybody is part of the same global Ubuntu Community, and attending an event help by another LoCo Team is a great way to expand you involvement.
46+ In the Ubuntu Community you are encouraged to participate with other teams, and that's true for Local Community Teams as well. Going to another team's event is a great way to meet new people, share experiences, and support Ubuntu in other parts of the world.
47+ So if you are in commuting distance of another team, or happen to be traveling in another team's part of the globe, be sure to check on their upcoming events and attend them when you can.
48+steps: Go to <tt>loco.ubuntu.com</tt> and find a team you are not a member of.
49+ View the list of upcoming events for that team, click on one you can attend.
50+ Click the 'Register' link on the upper-righthand corner of the page.
51+ Set your registration status to 'attending'.
52+ Attend the event in question and have a great time!
53+links: http://loco.ubuntu.com/teams/
54+help = #ubuntu-locoteams on Freenode
55+ #ubuntu-community-team on Freenode
56+author = Michael Hall <mhall119@ubuntu.com>
57
58=== added file 'accomplishments/ubuntu-community/en/advocacy/attend-ubuntu-hour.accomplishment'
59--- accomplishments/ubuntu-community/en/advocacy/attend-ubuntu-hour.accomplishment 1970-01-01 00:00:00 +0000
60+++ accomplishments/ubuntu-community/en/advocacy/attend-ubuntu-hour.accomplishment 2012-05-31 23:45:24 +0000
61@@ -0,0 +1,21 @@
62+[accomplishment]
63+title=Attend Ubuntu Hour Event
64+description=You attended an Ubuntu Hour with your Local Community
65+collection=ubuntu-community
66+category=LoCo Teams
67+needs-signing=true
68+icon=loco.png
69+depends=ubuntu-community/attend-loco-event
70+needs-information=launchpad-email
71+summary = The Ubuntu Global Jam is an incredible opportunity for the Ubuntu community to unite together to work together to improve Ubuntu.
72+ Everyone is able to contribute to the Jam, and everyone is welcome and encouraged to get involved.
73+ The Ubuntu Global Jam incorporates events that have been organized over the world to get Ubuntu contributors and fans together to have a great time and improve Ubuntu.
74+steps: Go to <tt>loco.ubuntu.com</tt> and find your nearest team.
75+ View the list of upcoming events for your team, click on one for an upcoming Ubuntu Hour.
76+ Click the 'Register' link on the upper-righthand corner of the page.
77+ Set your registration status to 'attending'.
78+ Attend the event in question and have a great time!
79+links: http://loco.ubuntu.com/events/
80+help = #ubuntu-locoteams on Freenode
81+ #ubuntu-community-team on Freenode
82+author = Michael Hall <mhall119@ubuntu.com>
83
84=== added file 'accomplishments/ubuntu-community/en/advocacy/organize-loco-event.accomplishment'
85--- accomplishments/ubuntu-community/en/advocacy/organize-loco-event.accomplishment 1970-01-01 00:00:00 +0000
86+++ accomplishments/ubuntu-community/en/advocacy/organize-loco-event.accomplishment 2012-05-31 23:45:24 +0000
87@@ -0,0 +1,19 @@
88+[accomplishment]
89+title=Organized a LoCo Team Event
90+description=You organized a Local Community Team event
91+collection=ubuntu-community
92+category=LoCo Teams
93+needs-signing=true
94+icon=loco.png
95+depends=ubuntu-community/registered-on-launchpad
96+needs-information=launchpad-email
97+summary = LoCo Teams often hold physical meetups where members can meet eachother in person, and they need somebody to organize and promote them. You can be a leader within your own LoCo Team by helping plan these events.
98+ Planning doesn't usually require much, all you need is a suitable venue (a coffee shop or library will do), pick a day and time, and let the rest of your team know about it.
99+steps: Go to <tt>loco.ubuntu.com</tt> and find your team.
100+ From the team page, click on 'Add New Event'.
101+ Set yourself as the Event Contact
102+ Organize the event in question and have a great time!
103+links: http://loco.ubuntu.com
104+help = #ubuntu-locoteams on Freenode
105+ #ubuntu-community-team on Freenode
106+author = Michael Hall <mhall119@ubuntu.com>
107
108=== added file 'scripts/ubuntu-community/advocacy/attend-global-jam.py'
109--- scripts/ubuntu-community/advocacy/attend-global-jam.py 1970-01-01 00:00:00 +0000
110+++ scripts/ubuntu-community/advocacy/attend-global-jam.py 2012-05-31 23:45:24 +0000
111@@ -0,0 +1,42 @@
112+#!/usr/bin/python
113+import traceback, sys
114+
115+import datetime
116+
117+from accomplishments.daemon import dbusapi
118+from launchpadlib.launchpad import Launchpad
119+
120+# Add scripts/lib/ to the PYTHONPATH
121+import os
122+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
123+from loco_team_portal import LocoTeamPortal
124+
125+GLOBAL_JAM_NAME = 'Ubuntu Global Jam'
126+
127+try:
128+
129+ api = dbusapi.Accomplishments()
130+ f = api.get_extra_information("ubuntu-community", "launchpad-email")
131+ if bool(f[0]["launchpad-email"]) == False:
132+ sys.exit(2)
133+ else:
134+ email = f[0]["launchpad-email"]
135+
136+ lp = Launchpad.login_anonymously(
137+ 'ubuntu-community accomplishments', 'production')
138+ me = lp.people.getByEmail(email=email)
139+ if me is None:
140+ sys.exit(1)
141+
142+ ltp = LocoTeamPortal()
143+ attending = ltp.getCollection('attendees', attendee_profile__user__username=me.name, promise="sure", team_event__date_begin__lt=datetime.datetime.now(), team_event__global_event__name=GLOBAL_JAM_NAME)
144+ if len(attending) > 0:
145+ sys.exit(0)
146+ else:
147+ sys.exit(1)
148+
149+except SystemExit, e:
150+ sys.exit(e.code)
151+except:
152+ traceback.print_exc()
153+ sys.exit(2)
154
155=== modified file 'scripts/ubuntu-community/advocacy/attend-loco-event.py'
156--- scripts/ubuntu-community/advocacy/attend-loco-event.py 2012-05-16 02:45:34 +0000
157+++ scripts/ubuntu-community/advocacy/attend-loco-event.py 2012-05-31 23:45:24 +0000
158@@ -2,50 +2,14 @@
159 import traceback, sys
160
161 import datetime
162-import urllib
163-try:
164- import json
165-except ImportError:
166- import simplejson as json
167
168 from accomplishments.daemon import dbusapi
169 from launchpadlib.launchpad import Launchpad
170
171-SERVICE_ROOT = 'http://loco.ubuntu.com/services'
172-
173-class LocoTeamPortal(object):
174-
175- def __init__(self, service_root=None):
176- self.service_root = service_root or SERVICE_ROOT
177- self.cache = {}
178-
179- def clearCache(self, resource=None):
180- if resource is None:
181- self.cache = {}
182- elif self.cache.has_key(resource):
183- self.cache[resource] = {}
184-
185- # Generic, caching Collection
186- def getCollection(self, resource, id_field='id', **kargs):
187- if not self.cache.has_key(resource):
188- self.cache[resource] = {}
189- url = '/'.join([self.service_root, resource, ''])
190- if len(kargs) > 0:
191- url = '?'.join([url, urllib.urlencode(kargs)])
192- s = urllib.urlopen(url)
193- col = dict([(o[id_field], o) for o in json.load(s)])
194- self.cache[resource].update(col)
195- return col
196-
197- # Generic, cacheable Entity
198- def getEntity(self, resource, entity_id):
199- if not self.cache.has_key(resource):
200- self.cache[resource] = {}
201- if not self.cache[resource].has_key(entity_id):
202- url = '/'.join([self.service_root, resource, str(entity_id)])
203- s = urllib.urlopen(url)
204- self.cache[resource][entity_id] = json.load(s)
205- return self.cache[resource][entity_id]
206+# Add scripts/lib/ to the PYTHONPATH
207+import os
208+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
209+from loco_team_portal import LocoTeamPortal
210
211 try:
212
213
214=== added file 'scripts/ubuntu-community/advocacy/attend-other-team-event.py'
215--- scripts/ubuntu-community/advocacy/attend-other-team-event.py 1970-01-01 00:00:00 +0000
216+++ scripts/ubuntu-community/advocacy/attend-other-team-event.py 2012-05-31 23:45:24 +0000
217@@ -0,0 +1,48 @@
218+#!/usr/bin/python
219+import traceback, sys
220+
221+import datetime
222+
223+from accomplishments.daemon import dbusapi
224+from launchpadlib.launchpad import Launchpad
225+
226+# Add scripts/lib/ to the PYTHONPATH
227+import os
228+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
229+from loco_team_portal import LocoTeamPortal
230+
231+try:
232+
233+ api = dbusapi.Accomplishments()
234+ f = api.get_extra_information("ubuntu-community", "launchpad-email")
235+ if bool(f[0]["launchpad-email"]) == False:
236+ sys.exit(2)
237+ else:
238+ email = f[0]["launchpad-email"]
239+
240+ lp = Launchpad.login_anonymously(
241+ 'ubuntu-community accomplishments', 'production')
242+ me = lp.people.getByEmail(email=email)
243+ if me is None:
244+ sys.exit(1)
245+
246+ ltp = LocoTeamPortal()
247+ # Get group membership
248+ member_groups = ltp.getCollection('groups', user__username=me.name)
249+ member_teams = [member_groups[group_id]['name'] for group_id in member_groups]
250+
251+ # Get all attended events
252+ attended_teams = ltp.getCollection('teams', teamevent__attendee__attendee_profile__user__username=me.name, teamevent__attendee__promise="sure", teamevent__date_begin__lt=datetime.datetime.now())
253+
254+ for team in attended_teams.values():
255+ # If the user attended an event for a team that they are not a member of, return true
256+ if team['lp_name'] not in member_teams:
257+ sys.exit(0)
258+
259+ sys.exit(1)
260+
261+except SystemExit, e:
262+ sys.exit(e.code)
263+except:
264+ traceback.print_exc()
265+ sys.exit(2)
266
267=== added file 'scripts/ubuntu-community/advocacy/attend-ubuntu-hour.py'
268--- scripts/ubuntu-community/advocacy/attend-ubuntu-hour.py 1970-01-01 00:00:00 +0000
269+++ scripts/ubuntu-community/advocacy/attend-ubuntu-hour.py 2012-05-31 23:45:24 +0000
270@@ -0,0 +1,42 @@
271+#!/usr/bin/python
272+import traceback, sys
273+
274+import datetime
275+
276+from accomplishments.daemon import dbusapi
277+from launchpadlib.launchpad import Launchpad
278+
279+# Add scripts/lib/ to the PYTHONPATH
280+import os
281+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
282+from loco_team_portal import LocoTeamPortal
283+
284+UBUNTU_HOUR_NAME = 'Ubuntu Hour'
285+
286+try:
287+
288+ api = dbusapi.Accomplishments()
289+ f = api.get_extra_information("ubuntu-community", "launchpad-email")
290+ if bool(f[0]["launchpad-email"]) == False:
291+ sys.exit(2)
292+ else:
293+ email = f[0]["launchpad-email"]
294+
295+ lp = Launchpad.login_anonymously(
296+ 'ubuntu-community accomplishments', 'production')
297+ me = lp.people.getByEmail(email=email)
298+ if me is None:
299+ sys.exit(1)
300+
301+ ltp = LocoTeamPortal()
302+ attending = ltp.getCollection('attendees', attendee_profile__user__username=me.name, promise="sure", team_event__date_begin__lt=datetime.datetime.now(), team_event__global_event__name=UBUNTU_HOUR_NAME)
303+ if len(attending) > 0:
304+ sys.exit(0)
305+ else:
306+ sys.exit(1)
307+
308+except SystemExit, e:
309+ sys.exit(e.code)
310+except:
311+ traceback.print_exc()
312+ sys.exit(2)
313
314=== added file 'scripts/ubuntu-community/advocacy/organize-loco-event.py'
315--- scripts/ubuntu-community/advocacy/organize-loco-event.py 1970-01-01 00:00:00 +0000
316+++ scripts/ubuntu-community/advocacy/organize-loco-event.py 2012-05-31 23:45:24 +0000
317@@ -0,0 +1,40 @@
318+#!/usr/bin/python
319+import traceback, sys
320+
321+import datetime
322+
323+from accomplishments.daemon import dbusapi
324+from launchpadlib.launchpad import Launchpad
325+
326+# Add scripts/lib/ to the PYTHONPATH
327+import os
328+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib')))
329+from loco_team_portal import LocoTeamPortal
330+
331+try:
332+
333+ api = dbusapi.Accomplishments()
334+ f = api.get_extra_information("ubuntu-community", "launchpad-email")
335+ if bool(f[0]["launchpad-email"]) == False:
336+ sys.exit(2)
337+ else:
338+ email = f[0]["launchpad-email"]
339+
340+ lp = Launchpad.login_anonymously(
341+ 'ubuntu-community accomplishments', 'production')
342+ me = lp.people.getByEmail(email=email)
343+ if me is None:
344+ sys.exit(1)
345+
346+ ltp = LocoTeamPortal()
347+ attending = ltp.getCollection('events', contact__user__username=me.name, date_begin__lt=datetime.datetime.now())
348+ if len(attending) > 0:
349+ sys.exit(0)
350+ else:
351+ sys.exit(1)
352+
353+except SystemExit, e:
354+ sys.exit(e.code)
355+except:
356+ traceback.print_exc()
357+ sys.exit(2)
358
359=== added directory 'scripts/ubuntu-community/lib'
360=== added file 'scripts/ubuntu-community/lib/__init__.py'
361=== added file 'scripts/ubuntu-community/lib/loco_team_portal.py'
362--- scripts/ubuntu-community/lib/loco_team_portal.py 1970-01-01 00:00:00 +0000
363+++ scripts/ubuntu-community/lib/loco_team_portal.py 2012-05-31 23:45:24 +0000
364@@ -0,0 +1,43 @@
365+# Wrapper around the LTP services API
366+import urllib
367+try:
368+ import json
369+except ImportError:
370+ import simplejson as json
371+
372+DEFAULT_SERVICE_ROOT = 'http://loco.ubuntu.com/services'
373+
374+class LocoTeamPortal(object):
375+
376+ def __init__(self, service_root=None):
377+ self.service_root = service_root or DEFAULT_SERVICE_ROOT
378+ self.cache = {}
379+
380+ def clearCache(self, resource=None):
381+ if resource is None:
382+ self.cache = {}
383+ elif self.cache.has_key(resource):
384+ self.cache[resource] = {}
385+
386+ # Generic, caching Collection
387+ def getCollection(self, resource, id_field='id', **kargs):
388+ if not self.cache.has_key(resource):
389+ self.cache[resource] = {}
390+ url = '/'.join([self.service_root, resource, ''])
391+ if len(kargs) > 0:
392+ url = '?'.join([url, urllib.urlencode(kargs)])
393+ s = urllib.urlopen(url)
394+ col = dict([(o[id_field], o) for o in json.load(s)])
395+ self.cache[resource].update(col)
396+ return col
397+
398+ # Generic, cacheable Entity
399+ def getEntity(self, resource, entity_id):
400+ if not self.cache.has_key(resource):
401+ self.cache[resource] = {}
402+ if not self.cache[resource].has_key(entity_id):
403+ url = '/'.join([self.service_root, resource, str(entity_id)])
404+ s = urllib.urlopen(url)
405+ self.cache[resource][entity_id] = json.load(s)
406+ return self.cache[resource][entity_id]
407+

Subscribers

People subscribed via source and target branches

to all changes: