Esempio n. 1
0
__all__ = [
    'namespace', 'Card', 'DisplayName', 'Homepage', 'Icon', 'Map', 'Sound'
]

namespace = "urn:ietf:params:xml:ns:pidf:cipid"
PIDFDocument.register_namespace(namespace, prefix='c', schema='cipid.xsd')


class Card(XMLAnyURIElement, PersonExtension, ServiceExtension):
    _xml_tag = 'card'
    _xml_namespace = namespace
    _xml_document = PIDFDocument


Person.register_extension('card', type=Card)
Service.register_extension('card', type=Card)


class DisplayName(XMLLocalizedStringElement, PersonExtension,
                  ServiceExtension):
    _xml_tag = 'display-name'
    _xml_namespace = namespace
    _xml_document = PIDFDocument


Person.register_extension('display_name', type=DisplayName)
Service.register_extension('display_name', type=DisplayName)


class Homepage(XMLAnyURIElement, PersonExtension, ServiceExtension):
Esempio n. 2
0
            else:
                activity = self._xml_item_other_type.from_string(activity)
        unknown_activity = self._xml_item_registry.class_map['unknown']()
        if activity == unknown_activity or unknown_activity in iter(
                self._element_map.values()):
            self.clear()
        super(Activities, self).add(activity)

    def check_validity(self):
        if not self:
            raise ValidationError(
                "Activity element must have at least one value")
        super(Activities, self).check_validity()


Person.register_extension('activities', type=Activities)


class MoodRegistry(object, metaclass=XMLEmptyElementRegistryType):
    _xml_namespace = namespace
    _xml_document = PIDFDocument

    names = ('afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'ashamed',
             'bored', 'brave', 'calm', 'cold', 'confused', 'contended',
             'cranky', 'curious', 'depressed', 'disappointed', 'disgusted',
             'distracted', 'embarrassed', 'excited', 'flirtatious',
             'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled',
             'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love',
             'indignant', 'interested', 'invisible', 'jealous', 'lonely',
             'mean', 'moody', 'nervous', 'neutral', 'offended', 'playful',
             'proud', 'relieved', 'remorseful', 'restless', 'sad', 'sarcastic',
Esempio n. 3
0
from sipsimple.payloads import XMLAnyURIElement, XMLLocalizedStringElement
from sipsimple.payloads.pidf import PIDFDocument, ServiceExtension, PersonExtension, Service, Person

__all__ = ["namespace", "Card", "DisplayName", "Homepage", "Icon", "Map", "Sound"]

namespace = "urn:ietf:params:xml:ns:pidf:cipid"
PIDFDocument.register_namespace(namespace, prefix="c", schema="cipid.xsd")


class Card(XMLAnyURIElement, PersonExtension, ServiceExtension):
    _xml_tag = "card"
    _xml_namespace = namespace
    _xml_document = PIDFDocument


Person.register_extension("card", type=Card)
Service.register_extension("card", type=Card)


class DisplayName(XMLLocalizedStringElement, PersonExtension, ServiceExtension):
    _xml_tag = "display-name"
    _xml_namespace = namespace
    _xml_document = PIDFDocument


Person.register_extension("display_name", type=DisplayName)
Service.register_extension("display_name", type=DisplayName)


class Homepage(XMLAnyURIElement, PersonExtension, ServiceExtension):
    _xml_tag = "homepage"
Esempio n. 4
0
        if isinstance(activity, basestring):
            if activity in self._xml_item_registry.names:
                activity = self._xml_item_registry.class_map[activity]()
            else:
                activity = self._xml_item_other_type.from_string(activity)
        unknown_activity = self._xml_item_registry.class_map['unknown']()
        if activity == unknown_activity or unknown_activity in self._element_map.itervalues():
            self.clear()
        super(Activities, self).add(activity)

    def check_validity(self):
        if not self:
            raise ValidationError("Activity element must have at least one value")
        super(Activities, self).check_validity()

Person.register_extension('activities', type=Activities)


class MoodRegistry(object):
    __metaclass__ = XMLEmptyElementRegistryType

    _xml_namespace = namespace
    _xml_document = PIDFDocument

    names = ('afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'ashamed',
             'bored', 'brave', 'calm', 'cold', 'confused', 'contended',
             'cranky', 'curious', 'depressed', 'disappointed', 'disgusted',
             'distracted', 'embarrassed', 'excited', 'flirtatious',
             'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled',
             'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love',
             'indignant', 'interested', 'invisible', 'jealous', 'lonely',
Esempio n. 5
0
from sipsimple.payloads import XMLAnyURIElement, XMLLocalizedStringElement
from sipsimple.payloads.pidf import PIDFDocument, ServiceExtension, PersonExtension, Service, Person

__all__ = ['namespace', 'Card', 'DisplayName', 'Homepage', 'Icon', 'Map', 'Sound']

namespace = "urn:ietf:params:xml:ns:pidf:cipid"
PIDFDocument.register_namespace(namespace, prefix='c', schema='cipid.xsd')


class Card(XMLAnyURIElement, PersonExtension, ServiceExtension):
    _xml_tag = 'card'
    _xml_namespace = namespace
    _xml_document = PIDFDocument

Person.register_extension('card', type=Card)
Service.register_extension('card', type=Card)

class DisplayName(XMLLocalizedStringElement, PersonExtension, ServiceExtension):
    _xml_tag = 'display-name'
    _xml_namespace = namespace
    _xml_document = PIDFDocument

Person.register_extension('display_name', type=DisplayName)
Service.register_extension('display_name', type=DisplayName)

class Homepage(XMLAnyURIElement, PersonExtension, ServiceExtension):
    _xml_tag = 'homepage'
    _xml_namespace = namespace
    _xml_document = PIDFDocument