Coverage for slidge/slixfix/xep_0153/stanza.py: 88%

16 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-11-07 05:11 +0000

1# Slixmpp: The Slick XMPP Library 

2# Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout 

3# This file is part of Slixmpp. 

4# See the file LICENSE for copying permission. 

5from slixmpp.xmlstream import ElementBase 

6 

7 

8class VCardTempUpdate(ElementBase): 

9 name = "x" 

10 namespace = "vcard-temp:x:update" 

11 plugin_attrib = "vcard_temp_update" 

12 interfaces = {"photo"} 

13 sub_interfaces = interfaces 

14 

15 def set_photo(self, value): 

16 if value is not None: 

17 self._set_sub_text("photo", value, keep=True) 

18 else: 

19 self._del_sub("photo") 

20 

21 def get_photo(self): 

22 photo = self.xml.find("{%s}photo" % self.namespace) 

23 if photo is None: 

24 return None 

25 return photo.text