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=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 _make_page(self, the_user, validate_error = None): the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() the_cancel_url=self.uri_for("memberinfo",mk=the_member_key.urlsafe()) template_args = { 'the_member' : the_member, 'member_is_me' : the_user == the_member, 'the_cancel_url' : the_cancel_url, 'lang' : lang, 'validate_error' : validate_error } self.render_template('member_edit.html', template_args)
def _make_page(self, the_user, validate_error=None): the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() the_cancel_url = self.uri_for("memberinfo", mk=the_member_key.urlsafe()) template_args = { 'the_member': the_member, 'member_is_me': the_user == the_member, 'the_cancel_url': the_cancel_url, 'lang': lang, 'validate_error': validate_error } self.render_template('member_edit.html', template_args)
def post(self): """ makes a new assoc for a member """ the_member_key = member.lookup_member_key(self.request) the_band_key=self.request.get('bk','0') if the_band_key=='0': raise Exception("Band not specified") the_member = the_member_key.get() the_band = band.band_key_from_urlsafe(the_band_key).get() if assoc.get_assoc_for_band_key_and_member_key(the_band_key = the_band.key, the_member_key = the_member_key) is None: assoc.new_association(the_member, the_band) goemail.send_new_member_email(the_band,the_member) # since our bands are changing, invalidate the band list in our session self.user.invalidate_member_bandlists(self, the_member.key)
def post(self): """ return the bands for a member """ the_member_key = member.lookup_member_key(self.request) the_assocs = assoc.get_assocs_of_member_key(the_member_key=the_member_key, confirmed_only=False) the_assoc_info=[] for an_assoc in the_assocs: the_assoc_info.append({ 'assoc' : an_assoc, 'sections' : band.get_section_keys_of_band_key(an_assoc.band) }) template_args = { 'the_member' : the_member_key.get(), 'the_assoc_info' : the_assoc_info, 'the_colors' : colors } self.render_template('member_band_assocs.html', template_args)
def post(self): """post handler - if we are edited by the template, handle it here and redirect back to info page""" validation_error = None try: the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() self.update_properties(the_member) self.update_preferences(the_member) the_member.put() except member.MemberError as e: validation_error = e.value if validation_error is not None: return self._make_page(self.user, validation_error) else: return self.redirect(self.uri_for("memberinfo", mk=the_member_key.urlsafe(), emailAddressChanged=the_member.pending_change_email))
def post(self): """ makes a new assoc for a member """ the_member_key = member.lookup_member_key(self.request) the_band_key = self.request.get('bk', '0') if the_band_key == '0': raise Exception("Band not specified") the_member = the_member_key.get() the_band = band.band_key_from_urlsafe(the_band_key).get() if assoc.get_assoc_for_band_key_and_member_key( the_band_key=the_band.key, the_member_key=the_member_key) is None: assoc.new_association(the_member, the_band) goemail.send_new_member_email(the_band, the_member) # since our bands are changing, invalidate the band list in our session self.user.invalidate_member_bandlists(self, the_member.key)
def post(self): """ return the bands for a member """ the_member_key = member.lookup_member_key(self.request) the_assocs = assoc.get_assocs_of_member_key( the_member_key=the_member_key, confirmed_only=False) the_assoc_info = [] for an_assoc in the_assocs: the_assoc_info.append({ 'assoc': an_assoc, 'sections': band.get_section_keys_of_band_key(an_assoc.band) }) template_args = { 'the_member': the_member_key.get(), 'the_assoc_info': the_assoc_info, 'the_colors': colors } self.render_template('member_band_assocs.html', template_args)
def post(self): """post handler - if we are edited by the template, handle it here and redirect back to info page""" validation_error = None try: the_member_key = member.lookup_member_key(self.request) the_member = the_member_key.get() self.update_properties(the_member) self.update_preferences(the_member) the_member.put() except member.MemberError as e: validation_error = e.value if validation_error is not None: return self._make_page(self.user, validation_error) else: return self.redirect( self.uri_for( "memberinfo", mk=the_member_key.urlsafe(), emailAddressChanged=the_member.pending_change_email))
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)