def get_band_list(cls, req, the_member_key): """ check to see if this is in the session - if so, just use it """ if 'member_bandlist' in req.session.keys() and not req.member_cache_is_dirty(the_member_key): the_bands = req.session['member_bandlist'] else: band_keys=assoc.get_band_keys_of_member_key(the_member_key, confirmed_only=True) the_bands = [bandkey.get() for bandkey in band_keys] req.session['member_bandlist'] = the_bands return the_bands
def post(self): """ return the bands for a member """ the_band_keys=assoc.get_band_keys_of_member_key(the_member_key=member.lookup_member_key(self.request), confirmed_only=False) every_band = band.get_all_bands() all_bands = [a_band for a_band in every_band if a_band.key not in the_band_keys] template_args = { 'all_bands' : all_bands } self.render_template('member_band_popup.html', template_args)
def post(self): """ return the bands for a member """ the_band_keys=assoc.get_band_keys_of_member_key(the_member_key=lookup_member_key(self.request), confirmed_only=False) every_band = band.get_all_bands() all_bands = [a_band for a_band in every_band if a_band.key not in the_band_keys] template_args = { 'all_bands' : all_bands } self.render_template('member_band_popup.html', template_args)
def get_add_gig_band_list(cls, req, the_member_key): """ check to see if this is in the session - if so, just use it """ if 'member_addgigbandlist' in req.session.keys() and not req.member_cache_is_dirty(the_member_key): the_manage_bands = req.session['member_addgigbandlist'] else: band_keys=assoc.get_band_keys_of_member_key(the_member_key, confirmed_only=True) the_bands = ndb.get_multi(band_keys) the_manage_bands = [] for b in the_bands: if b.anyone_can_manage_gigs or \ req.user.is_superuser or \ assoc.get_admin_status_for_member_for_band_key(req.user, b.key): the_manage_bands.append(b) req.session['member_addgigbandlist'] = the_manage_bands return the_manage_bands
def get_add_gig_band_list(cls, req, the_member_key): """ check to see if this is in the session - if so, just use it """ if hasattr(req,'session') is False: return [] if 'member_addgigbandlist' in req.session.keys() and not req.member_cache_is_dirty(the_member_key): the_manage_bands = req.session['member_addgigbandlist'] else: band_keys=assoc.get_band_keys_of_member_key(the_member_key, confirmed_only=True) the_bands = ndb.get_multi(band_keys) the_manage_bands = [] for b in the_bands: if b.anyone_can_create_gigs or \ req.user.is_superuser or \ assoc.get_admin_status_for_member_for_band_key(req.user, b.key): the_manage_bands.append(b) req.session['member_addgigbandlist'] = the_manage_bands return the_manage_bands
def post(self): """ return the bands for a member """ the_user = self.user the_member_key=self.request.get('mk','0') if the_member_key=='0': return # todo figure out what to do the_member_key=ndb.Key(urlsafe=the_member_key) the_band_keys=assoc.get_band_keys_of_member_key(the_member_key=the_member_key, confirmed_only=False) every_band = band.get_all_bands() all_bands = [a_band for a_band in every_band if a_band.key not in the_band_keys] template_args = { 'all_bands' : all_bands } self.render_template('member_band_popup.html', template_args)
def get_forums(cls, req, the_member_key): import forum """ check to see if this is in the session - if so, just use it """ if 'member_forumlist' in req.session.keys( ) and not req.member_cache_is_dirty(the_member_key): the_forums = req.session['member_forumlist'] else: band_keys = assoc.get_band_keys_of_member_key(the_member_key, confirmed_only=True) if band_keys: # only do this if we're a member of a band bands = ndb.get_multi(band_keys) band_forums = [] for b in bands: if b.enable_forum: band_forums.append(b) public_forum_keys = forum.get_public_forums(keys_only=True) public_forums = ndb.get_multi(public_forum_keys) the_forums = band_forums + public_forums req.session['member_forumlist'] = the_forums else: the_forums = [] return the_forums
def _make_page(self, the_user): the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() ok_to_show = False same_band = False if the_member_key == the_user.key: is_me = True ok_to_show = True else: is_me = False # find the bands this member is associated with the_band_keys = assoc.get_band_keys_of_member_key( the_member_key=the_member_key, confirmed_only=True) if is_me == False: # are we at least in the same band, or superuser? if the_user.is_superuser: ok_to_show = True the_other_band_keys = assoc.get_band_keys_of_member_key( the_member_key=the_user.key, confirmed_only=True) for b in the_other_band_keys: if b in the_band_keys: ok_to_show = True same_band = True break if ok_to_show == False: # check to see if we're sharing our profile - if not, bail! if (the_member.preferences and the_member.preferences.share_profile == False) and the_user.is_superuser == False: return self.redirect('/') email_change = self.request.get('emailAddressChanged', False) if email_change: email_change_msg = 'You have selected a new email address - check your inbox to verify!' else: email_change_msg = None # if I'm not sharing my email, don't share my email show_email = False if the_member_key == the_user.key or the_user.is_superuser: show_email = True elif the_member.preferences and the_member.preferences.share_profile and the_member.preferences.share_email: show_email = True show_phone = False if the_member == the_user.key or the_user.is_superuser: show_phone = True else: # are we in the same band? If so, always show email and phone if same_band: show_phone = True show_email = True template_args = { 'the_member': the_member, 'the_band_keys': the_band_keys, 'member_is_me': the_user == the_member, 'email_change_msg': email_change_msg, 'show_email': show_email, 'show_phone': show_phone } self.render_template('member_info.html', template_args)
def _make_page(self,the_user): the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() ok_to_show = False same_band = False if the_member_key == the_user.key: is_me = True ok_to_show = True else: is_me = False # find the bands this member is associated with the_band_keys=assoc.get_band_keys_of_member_key(the_member_key=the_member_key, confirmed_only=True) if is_me == False: # are we at least in the same band, or superuser? if the_user.is_superuser: ok_to_show = True the_other_band_keys = assoc.get_band_keys_of_member_key(the_member_key=the_user.key, confirmed_only=True) for b in the_other_band_keys: if b in the_band_keys: ok_to_show = True same_band = True break if ok_to_show == False: # check to see if we're sharing our profile - if not, bail! if (the_member.preferences and the_member.preferences.share_profile == False) and the_user.is_superuser == False: return self.redirect('/') email_change = self.request.get('emailAddressChanged',False) if email_change: email_change_msg='You have selected a new email address - check your inbox to verify!' else: email_change_msg = None # if I'm not sharing my email, don't share my email show_email = False if the_member_key == the_user.key or the_user.is_superuser: show_email = True elif the_member.preferences and the_member.preferences.share_profile and the_member.preferences.share_email: show_email = True show_phone = False if the_member == the_user.key or the_user.is_superuser: show_phone = True else: # are we in the same band? If so, always show email and phone if same_band: show_phone = True show_email = True template_args = { 'the_member' : the_member, 'the_band_keys' : the_band_keys, 'member_is_me' : the_user == the_member, 'email_change_msg' : email_change_msg, 'show_email' : show_email, 'show_phone' : show_phone } self.render_template('member_info.html', template_args)
def _make_page(self,the_user): the_member_key=self.request.get("mk",'0') if the_member_key!='0': # if we've just edited this member, the database may not have # invalidated the cache. Therefore, use a method to get the # member that uses an ancestor query. the_member=ndb.Key(urlsafe=the_member_key).get() else: return # todo what to do if it's not passed in? if the_member is None: self.response.write('did not find a member!') return # todo figure out what to do if we didn't find it ok_to_show = False same_band = False if the_member.key == the_user.key: is_me = True ok_to_show = True else: is_me = False # find the bands this member is associated with the_band_keys=assoc.get_band_keys_of_member_key(the_member_key=the_member.key, confirmed_only=True) if is_me == False: # are we at least in the same band, or superuser? if the_user.is_superuser: ok_to_show = True the_other_band_keys = assoc.get_band_keys_of_member_key(the_member_key=the_user.key, confirmed_only=True) for b in the_other_band_keys: if b in the_band_keys: ok_to_show = True same_band = True break if ok_to_show == False: # check to see if we're sharing our profile - if not, bail! if (the_member.preferences and the_member.preferences.share_profile == False) and the_user.is_superuser == False: return self.redirect('/') email_change = self.request.get('e',False) if email_change: email_change_msg='You have selected a new email address - check your inbox to verify!' else: email_change_msg = None # if I'm not sharing my email, don't share my email show_email = False if the_member.key == the_user.key or the_user.is_superuser: show_email = True elif the_member.preferences and the_member.preferences.share_profile and the_member.preferences.share_email: show_email = True show_phone = False if the_member.key == the_user.key or the_user.is_superuser: show_phone = True else: # are we in the same band? If so, always show email and phone if same_band: show_phone = True show_email = True template_args = { 'the_member' : the_member, 'the_band_keys' : the_band_keys, 'member_is_me' : the_user == the_member, 'email_change_msg' : email_change_msg, 'show_email' : show_email, 'show_phone' : show_phone } self.render_template('member_info.html', template_args)