コード例 #1
0
ファイル: activity.py プロジェクト: jerrayl/DHTribes-source
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #2
0
ファイル: reader.py プロジェクト: nickyfoto/Endpoints
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     # https://cloud.google.com/appengine/docs/python/tools/protorpc/messages/messageclass#all_fields
     for field in pf.all_fields():
         if hasattr(prof, field.name):    
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #3
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #4
0
ファイル: conference.py プロジェクト: Taiyi/Conference
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #5
0
 def toProfileForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #6
0
ファイル: conference.py プロジェクト: aguijarro/conference
    def _copyProfileToForm(self, prof):

        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
コード例 #7
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     pf = ProfileForm()
     # Loop through all fields and copy data to form
     for field in pf.all_fields():
         if hasattr(prof, field.name):
           
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #8
0
    def _copyProfileToForm(self, prof):

        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name,
                            getattr(TeeShirtSize, getattr(prof, field.name)))
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
コード例 #9
0
 def _copyProfileToForm(self, prof):
     """ Copy relevant fields from Profile to ProfileForm. """
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name,
                         getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #10
0
ファイル: conference.py プロジェクト: AdamVanOijen/Project-4
    def _copyProfileToForm(self, prof):
        """Copy relevant fields from Profile to ProfileForm."""
        # copy relevant fields from Profile to ProfileForm
        pf = ProfileForm()
        for field in pf.all_fields():
            if hasattr(prof, field.name) and not field.name == 'conferenceKeysToAttend':
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))

                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     logging.debug("Did run _copyProfileToForm()")
     return pf
コード例 #12
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             elif field.name == 'sessionWishlist':
                 setattr(pf, field.name, [k.urlsafe() for k in getattr(prof, field.name)])
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #13
0
 def _copyProfileToForm(self, profile):
     """Copy relevant fields from Profile to ProfileForm."""
     profileForm = ProfileForm()
     for field in profileForm.all_fields():
         if hasattr(profile, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr( profileForm,
                          field.name,
                          getattr(TeeShirtSize, getattr(profile, field.name)) )
             else:
                 setattr( profileForm,
                          field.name,
                          getattr(profile, field.name) )
     profileForm.check_initialized()
     return profileForm
コード例 #14
0
ファイル: editMethods.py プロジェクト: Flap-Py/NotesCC
def editProfileMethod(request):
    try:
        fields = ProfileForm.all_fields()
        profileId = ndb.Key(urlsafe=getattr(request, 'profileId'))
        profile = profileId.get()
        for field in fields:
            value = getattr(request, field.name, None)
            if field.name == 'collegeId':
                continue
            if value is None or value == "" or value == []:
                continue
            setattr(profile, field.name, value)
        profile.put()
        return Response(response=0, description="OK")
    except Exception, E:
        return Response(response=1, description=str(E))
コード例 #15
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     print pf
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             # getattr(object, name[, default]):Return the value of the named attr. or default
             # setattr(object, name, value)
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #16
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             elif (field.name == 'sessionKeysToAttend' or field.name == 'conferenceKeysToAttend'):
                 new_list = [item.get().key.urlsafe() for item in getattr(prof, field.name)]
                 setattr(pf, field.name, new_list)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #17
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == "teeShirtSize":
                 setattr(pf, field.name, getattr(TeeShirtSize, getattr(prof, field.name)))
             if field.name == "websafeSessionKeysWishlist":
                 sessionKeysWishlist = getattr(prof, "sessionKeysWishlist")
                 websafeSessionKeysWishlist = [k.urlsafe() for k in websafeSessionKeysWishlist]
                 setattr(pf, field.name, websafeSessionKeysWishlist)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #18
0
ファイル: conference.py プロジェクト: powebdev/p4_conference
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert t-shirt string to Enum; just copy others
             if field.name == 'teeShirtSize':
                 setattr(pf, field.name, getattr(
                     TeeShirtSize, getattr(prof, field.name)))
             elif field.name == "sessionKeysWishlist":
                 all_keys = []
                 for each_key in prof.sessionKeysWishlist:
                     all_keys.append(each_key.urlsafe())
                 setattr(pf, field.name, all_keys)
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #19
0
 def _copyProfileToForm(self, prof):
     """Copy relevant fields from Profile to ProfileForm."""
     # copy relevant fields from Profile to ProfileForm
     pf = ProfileForm()
     for field in pf.all_fields():
         if hasattr(prof, field.name):
             # convert key objects to websafekey, put it back in a list
             if field.name.endswith('Attend'):
                 key_list = [x.urlsafe() for x in getattr(prof, field.name)]
                 setattr(pf, field.name, key_list)
             # convert t-shirt string to Enum;
             elif field.name == 'teeShirtSize':
                 setattr(pf, field.name,
                         getattr(TeeShirtSize, getattr(prof, field.name)))
             # just copy others
             else:
                 setattr(pf, field.name, getattr(prof, field.name))
     pf.check_initialized()
     return pf
コード例 #20
0
ファイル: conference.py プロジェクト: amharF/udacity-ND-P4
    def _copyProfileToForm(self, prof):
        """Copy relevant fields from Profile to ProfileForm."""
        # copy relevant fields from Profile to ProfileForm
        pf = ProfileForm()

        for field in pf.all_fields():
            if hasattr(prof, field.name):
                # convert t-shirt string to Enum; just copy others
                if field.name == 'teeShirtSize':
                    setattr(pf, field.name,
                            getattr(TeeShirtSize, getattr(prof, field.name)))
                elif field.name == 'conferenceKeysToAttend':
                    setattr(pf, field.name, [conf.urlsafe() for conf \
                        in prof.conferenceKeysToAttend])
                elif field.name == 'sessionKeysToAttend':
                    setattr(pf, field.name, [sess.urlsafe() for sess \
                        in prof.sessionKeysToAttend])
                else:
                    setattr(pf, field.name, getattr(prof, field.name))
        pf.check_initialized()
        return pf