Пример #1
0
    def buildFromXMLElement(self, xml_root):
        if (not xml_root.find('id') is None):
            self.id = xml_root.find('id').text
        if (not xml_root.find('username') is None):
            self.username = xml_root.find('username').text
        if (not xml_root.find('first_name') is None):
            self.first_name = xml_root.find('first_name').text
        if (not xml_root.find('last_name') is None):
            self.last_name = xml_root.find('last_name').text
        if (not xml_root.find('email') is None):
            self.email = xml_root.find('email').text
        if (not xml_root.find('auth_provider') is None):
            self.auth_provider = xml_root.find('auth_provider').text
        if (not xml_root.find('auth_provider_id') is None):
            self.auth_provider_id = xml_root.find('auth_provider_id').text
        
        if (not xml_root.find('first_login') is None) and (not xml_root.find('first_login').text is None):
            self.first_login = convertToDateTime(xml_root.find('first_login').text)

        if (not xml_root.find('last_login') is None) and (not xml_root.find('last_login').text is None):
            self.last_login = convertToDateTime(xml_root.find('last_login').text)

        if (not xml_root.find('profile_picture_url') is None):
            self.profile_picture_url = xml_root.find('profile_picture_url').text
        if (not xml_root.find('custom_profile_picture_url') is None):
            self.custom_profile_picture_url = xml_root.find('custom_profile_picture_url').text
        if (not xml_root.find('profile_url') is None):
            self.profile_url = xml_root.find('profile_url').text
        
        groupsElement = xml_root.find('groups')
        if (not groupsElement is None):    
            self.groups=[]
            for groupElement in groupsElement.findall('group'):
                self.groups.append(groupElement.text)   
                
        permissionsElement = xml_root.find('permissions')
        if (not permissionsElement is None):    
            self.permissions=[]
            for permissionsElement in permissionsElement.findall('permission'):
                self.permissions.append(permissionsElement.text) 
              
        if (not xml_root.find('active') is None):
            self.active = (xml_root.find('active').text == 'true')    
        if (not xml_root.find('bio') is None):
            self.bio = xml_root.find('bio').text
            
        if (not xml_root.find('hide_profile') is None):
            self.hide_profile = (xml_root.find('hide_profile').text == 'true')  
        if (not xml_root.find('hide_votes') is None):
            self.hide_votes = (xml_root.find('hide_votes').text == 'true')  
        if (not xml_root.find('use_username') is None):
            self.use_username = (xml_root.find('use_username').text == 'true') 
        if (not xml_root.find('use_custom_profile_picture') is None):
            self.use_custom_profile_picture = (xml_root.find('use_custom_profile_picture').text == 'true')   
Пример #2
0
    def buildFromXMLElement(self, xml_root):
        if (not xml_root.find('session_id') is None):
            self.session_id = xml_root.find('session_id').text
        if (not xml_root.find('user_token') is None):
            self.user_token = xml_root.find('user_token').text
        if (not xml_root.find('reckoner_user_id') is None):
            self.reckoner_user_id = xml_root.find('reckoner_user_id').text
        if (not xml_root.find('auth_provider') is None):
            self.first_name = xml_root.find('auth_provider').text
        
        if (not xml_root.find('created_date') is None) and (not xml_root.find('created_date').text is None):
            self.created_date = convertToDateTime(xml_root.find('created_date').text)

        if (not xml_root.find('expiration_date') is None) and (not xml_root.find('expiration_date').text is None):
            self.expiration_date = convertToDateTime(xml_root.find('expiration_date').text)     
Пример #3
0
 def buildFromXMLElement(self, xml_root):
     if (not xml_root.find('comment_id') is None):
         self.id = xml_root.find('comment_id').text
     if (not xml_root.find('comment') is None):
         self.comment = xml_root.find('comment').text
     if (not xml_root.find('poster_id') is None):
         self.poster_id = xml_root.find('poster_id').text
     
     if (not xml_root.find('posting_date') is None) and (not xml_root.find('posting_date').text is None):
         self.posting_date = convertToDateTime(xml_root.find('posting_date').text)
     
     flagsElement = xml_root.find('flags')        
     if (not flagsElement is None):
         self.flags=[]
         for flagElement in flagsElement.findall('flag'):
             self.flags.append(Flag(xml_element=flagElement))
     
     favoritesElement = xml_root.find('favorites')
     if (not favoritesElement is None):               
         self.favorites=[]
         for favoriteElement in favoritesElement.findall('favorite'):
             self.favorites.append(Favorite(xml_element=favoriteElement))
             
     if (not xml_root.find('user') is None):
         self.user=ReckonerUser(xml_element=xml_root.find('user'))        
Пример #4
0
 def buildFromXMLElement(self, xml_root):
     if (not xml_root.find('loc') is None):
         self.loc = xml_root.find('loc').text
         
     if (not xml_root.find('lastmod') is None) and (not xml_root.find('lastmod').text is None):
         self.lastmod = convertToDateTime(xml_root.find('lastmod').text)
         
     if (not xml_root.find('changefreq') is None):
         self.changefreq = xml_root.find('changefreq').text
     if (not xml_root.find('priority') is None):
         self.priority = xml_root.find('priority').text
Пример #5
0
 def buildFromXMLElement(self, xml_root):
     if (not xml_root.find('voter_id') is None):
         self.voter_id = xml_root.find('voter_id').text
     if (not xml_root.find('reckoning_id') is None):
         self.reckoning_id = xml_root.find('reckoning_id').text        
     if (not xml_root.find('answer_index') is None):
         self.answer_index = xml_root.find('answer_index').text
     
     if (not xml_root.find('voting_date') is None) and (not xml_root.find('voting_date').text is None):
         self.voting_date = convertToDateTime(xml_root.find('voting_date').text)
         
     if (not xml_root.find('anonymous') is None):
         self.anonymous = (xml_root.find('anonymous').text == 'true')
     if (not xml_root.find('ip') is None):
         self.ip = xml_root.find('ip').text
     if (not xml_root.find('user_agent') is None):
         self.user_agent = xml_root.find('user_agent').text
     if (not xml_root.find('latitude') is None):
         self.latitude = xml_root.find('latitude').text
     if (not xml_root.find('longitude') is None):
         self.longitude = xml_root.find('longitude').text    
         
     if (not xml_root.find('voting_user') is None):
         self.voting_user=ReckonerUser(xml_element = xml_root.find('voting_user'))
Пример #6
0
    def buildFromXMLElement(self, xml_root):
        if (not xml_root.find('id') is None):
            self.id = xml_root.find('id').text
        if (not xml_root.find('question') is None):
            self.question = xml_root.find('question').text
        if (not xml_root.find('description') is None):
            self.description = xml_root.find('description').text
        
        answersElement = xml_root.find('answers')
        if (not answersElement is None):
            self.answers=[]
            for answerElement in answersElement.findall('answer'):
                self.answers.append(Answer(xml_element=answerElement))
        
        if (not xml_root.find('submitter_id') is None):
            self.submitter_id = xml_root.find('submitter_id').text
        if (not xml_root.find('approver_id') is None):
            self.approver_id = xml_root.find('approver_id').text
        if (not xml_root.find('approved') is None):
            self.approved = (xml_root.find('approved').text == 'true')
        if (not xml_root.find('rejected') is None):
            self.rejected = (xml_root.find('rejected').text == 'true')
        if (not xml_root.find('open') is None):
            self.open = (xml_root.find('open').text == 'true')
        if (not xml_root.find('anonymous') is None):
            self.anonymous = (xml_root.find('anonymous').text == 'true')
        if (not xml_root.find('anonymous_requested') is None):
            self.anonymous_requested = (xml_root.find('anonymous_requested').text == 'true')
        
        if (not xml_root.find('submission_date') is None) and (not xml_root.find('submission_date').text is None):
            self.submission_date = convertToDateTime(xml_root.find('submission_date').text)
        if (not xml_root.find('posting_date') is None) and (not xml_root.find('posting_date').text is None):
            self.posting_date = convertToDateTime(xml_root.find('posting_date').text)
        if (not xml_root.find('closing_date') is None) and (not xml_root.find('closing_date').text is None):
            self.closing_date = convertToDateTime(xml_root.find('closing_date').text)

        if (not xml_root.find('interval') is None):            
            self.interval = xml_root.find('interval').text
        if (not xml_root.find('comment_index') is None):
            self.comment_index = xml_root.find('comment_index').text
            
        if (not xml_root.find('commentary') is None):
            self.commentary = xml_root.find('commentary').text
        if (not xml_root.find('commentary_user_id') is None):
            self.commentary_user_id = xml_root.find('commentary_user_id').text
        if (not xml_root.find('commentary_user') is None):
            self.commentary_user=ReckonerUser(xml_element = xml_root.find('commentary_user'))

        if (not xml_root.find('posting_user') is None):
            self.posting_user=ReckonerUser(xml_element = xml_root.find('posting_user'))

        commentsElement = xml_root.find('comments')
        if (not commentsElement is None):
            self.comments=[]
            for commentElement in commentsElement.findall('comment'):
                self.comments.append(Comment(xml_element=commentElement))
                
        mediaItemsElement = xml_root.find('media_items')
        if (not mediaItemsElement is None):
            self.media_items=[]
            for mediaElement in mediaItemsElement.findall('media'):
                self.media_items.append(Media(xml_element=mediaElement))
           
        flagsElement = xml_root.find('flags')        
        if (not flagsElement is None):
            self.flags=[]
            for flagElement in flagsElement.findall('flag'):
                self.flags.append(Flag(xml_element=flagElement))
        
        favoritesElement = xml_root.find('favorites')
        if (not favoritesElement is None):               
            self.favorites=[]
            for favoriteElement in favoritesElement.findall('favorite'):
                self.favorites.append(Favorite(xml_element=favoriteElement))
        
        tagsElement = xml_root.find('tags')
        if (not tagsElement is None):    
            tags=[]
            for tagElement in tagsElement.findall('tag'):
                tags.append(tagElement.text)
                self.tags = self.buildTagList(tags)

        if (not xml_root.find('highlighted') is None):           
            self.highlighted = (xml_root.find('highlighted').text == 'true')
            
        if (not xml_root.find('views') is None):
            self.views = xml_root.find('views').text
Пример #7
0
 def buildFromXMLElement(self, xml_root):
     if (not xml_root.find('user_id') is None):        
         self.user_id = xml_root.find('user_id').text
     if (not xml_root.find('favorite_date') is None) and (not xml_root.find('favorite_date').text is None):
         self.favorite_date = convertToDateTime(xml_root.find('favorite_date').text)