Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Aug 9, 2021
1 parent ff4e660 commit 762819f
Show file tree
Hide file tree
Showing 57 changed files with 1,494 additions and 855 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Change Log
==========

HEAD
----
4.5.0
-----
- Fixed bug when updating indexed fields on `Contact` items.
- Fixed bug preventing parsing of `CalendarPermission` items in the `permission_set` field.
- Add support for parsing push notification POST requests sent from the Exchange server
Expand Down
51 changes: 47 additions & 4 deletions docs/exchangelib/fields.html
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ <h1 class="title">Module <code>exchangelib.fields</code></h1>


class SubField(Field):
&#34;&#34;&#34;A field to hold the value on an SingleFieldIndexedElement.&#34;&#34;&#34;
&#34;&#34;&#34;A field to hold the value on an IndexedElement.&#34;&#34;&#34;

namespace = TNS
value_cls = str
Expand All @@ -1221,6 +1221,12 @@ <h1 class="title">Module <code>exchangelib.fields</code></h1>
from .properties import IndexedFieldURI
return IndexedFieldURI(field_uri=field_uri, field_index=label).to_xml(version=None)

def clean(self, value, version=None):
value = super().clean(value, version=version)
if self.is_required and not value:
raise ValueError(&#39;Value for subfield %r must be non-empty&#39; % self.name)
return value

def __hash__(self):
return hash(self.name)

Expand Down Expand Up @@ -1272,6 +1278,13 @@ <h1 class="title">Module <code>exchangelib.fields</code></h1>

PARENT_ELEMENT_NAME = None

def __init__(self, *args, **kwargs):
from .indexed_properties import IndexedElement
value_cls = kwargs[&#39;value_cls&#39;]
if not issubclass(value_cls, IndexedElement):
raise ValueError(&#34;&#39;value_cls&#39; %r must be a subclass of IndexedElement&#34; % value_cls)
super().__init__(*args, **kwargs)

def to_xml(self, value, version):
return set_xml_value(create_element(&#39;t:%s&#39; % self.PARENT_ELEMENT_NAME), value, version)

Expand Down Expand Up @@ -5031,6 +5044,13 @@ <h3>Inherited members</h3>

PARENT_ELEMENT_NAME = None

def __init__(self, *args, **kwargs):
from .indexed_properties import IndexedElement
value_cls = kwargs[&#39;value_cls&#39;]
if not issubclass(value_cls, IndexedElement):
raise ValueError(&#34;&#39;value_cls&#39; %r must be a subclass of IndexedElement&#34; % value_cls)
super().__init__(*args, **kwargs)

def to_xml(self, value, version):
return set_xml_value(create_element(&#39;t:%s&#39; % self.PARENT_ELEMENT_NAME), value, version)

Expand Down Expand Up @@ -6295,13 +6315,13 @@ <h3>Ancestors</h3>
<span>(</span><span>name=None, is_required=False, is_required_after_save=False, is_read_only=False, is_read_only_after_send=False, is_searchable=True, is_attribute=False, default=None, supported_from=None, deprecated_from=None)</span>
</code></dt>
<dd>
<div class="desc"><p>A field to hold the value on an SingleFieldIndexedElement.</p></div>
<div class="desc"><p>A field to hold the value on an IndexedElement.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class SubField(Field):
&#34;&#34;&#34;A field to hold the value on an SingleFieldIndexedElement.&#34;&#34;&#34;
&#34;&#34;&#34;A field to hold the value on an IndexedElement.&#34;&#34;&#34;

namespace = TNS
value_cls = str
Expand All @@ -6317,6 +6337,12 @@ <h3>Ancestors</h3>
from .properties import IndexedFieldURI
return IndexedFieldURI(field_uri=field_uri, field_index=label).to_xml(version=None)

def clean(self, value, version=None):
value = super().clean(value, version=version)
if self.is_required and not value:
raise ValueError(&#39;Value for subfield %r must be non-empty&#39; % self.name)
return value

def __hash__(self):
return hash(self.name)</code></pre>
</details>
Expand Down Expand Up @@ -6368,6 +6394,22 @@ <h3>Static methods</h3>
</dl>
<h3>Methods</h3>
<dl>
<dt id="exchangelib.fields.SubField.clean"><code class="name flex">
<span>def <span class="ident">clean</span></span>(<span>self, value, version=None)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def clean(self, value, version=None):
value = super().clean(value, version=version)
if self.is_required and not value:
raise ValueError(&#39;Value for subfield %r must be non-empty&#39; % self.name)
return value</code></pre>
</details>
</dd>
<dt id="exchangelib.fields.SubField.from_xml"><code class="name flex">
<span>def <span class="ident">from_xml</span></span>(<span>self, elem, account)</span>
</code></dt>
Expand Down Expand Up @@ -7494,7 +7536,8 @@ <h4><code><a title="exchangelib.fields.StringAttributedValueField" href="#exchan
</li>
<li>
<h4><code><a title="exchangelib.fields.SubField" href="#exchangelib.fields.SubField">SubField</a></code></h4>
<ul class="">
<ul class="two-column">
<li><code><a title="exchangelib.fields.SubField.clean" href="#exchangelib.fields.SubField.clean">clean</a></code></li>
<li><code><a title="exchangelib.fields.SubField.field_uri_xml" href="#exchangelib.fields.SubField.field_uri_xml">field_uri_xml</a></code></li>
<li><code><a title="exchangelib.fields.SubField.from_xml" href="#exchangelib.fields.SubField.from_xml">from_xml</a></code></li>
<li><code><a title="exchangelib.fields.SubField.namespace" href="#exchangelib.fields.SubField.namespace">namespace</a></code></li>
Expand Down
2 changes: 1 addition & 1 deletion docs/exchangelib/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1 class="title">Package <code>exchangelib</code></h1>
from .transport import BASIC, DIGEST, NTLM, GSSAPI, SSPI, OAUTH2, CBA
from .version import Build, Version

__version__ = &#39;4.4.0&#39;
__version__ = &#39;4.5.0&#39;

__all__ = [
&#39;__version__&#39;,
Expand Down
62 changes: 35 additions & 27 deletions docs/exchangelib/indexed_properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1 class="title">Module <code>exchangelib.indexed_properties</code></h1>
class IndexedElement(EWSElement, metaclass=EWSMeta):
&#34;&#34;&#34;Base class for all classes that implement an indexed element.&#34;&#34;&#34;

LABELS = set()
LABEL_CHOICES = ()


class SingleFieldIndexedElement(IndexedElement, metaclass=EWSMeta):
Expand All @@ -58,21 +58,21 @@ <h1 class="title">Module <code>exchangelib.indexed_properties</code></h1>
LABEL_CHOICES = (&#39;EmailAddress1&#39;, &#39;EmailAddress2&#39;, &#39;EmailAddress3&#39;)

label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=LABEL_CHOICES[0])
email = EmailSubField()
email = EmailSubField(is_required=True)


class PhoneNumber(SingleFieldIndexedElement):
&#34;&#34;&#34;MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/entry-phonenumber&#34;&#34;&#34;

ELEMENT_NAME = &#39;Entry&#39;
LABEL_CHOICES = (
&#39;AssistantPhone&#39;, &#39;BusinessFax&#39;, &#39;BusinessPhone&#39;, &#39;BusinessPhone2&#39;, &#39;Callback&#39;, &#39;CarPhone&#39;, &#39;CompanyMainPhone&#39;,
&#39;HomeFax&#39;, &#39;HomePhone&#39;, &#39;HomePhone2&#39;, &#39;Isdn&#39;, &#39;MobilePhone&#39;, &#39;OtherFax&#39;, &#39;OtherTelephone&#39;, &#39;Pager&#39;,
&#39;PrimaryPhone&#39;, &#39;RadioPhone&#39;, &#39;Telex&#39;, &#39;TtyTddPhone&#39;
)

label = LabelField(field_uri=&#39;Key&#39;, choices={
Choice(&#39;AssistantPhone&#39;), Choice(&#39;BusinessFax&#39;), Choice(&#39;BusinessPhone&#39;), Choice(&#39;BusinessPhone2&#39;),
Choice(&#39;Callback&#39;), Choice(&#39;CarPhone&#39;), Choice(&#39;CompanyMainPhone&#39;), Choice(&#39;HomeFax&#39;), Choice(&#39;HomePhone&#39;),
Choice(&#39;HomePhone2&#39;), Choice(&#39;Isdn&#39;), Choice(&#39;MobilePhone&#39;), Choice(&#39;OtherFax&#39;), Choice(&#39;OtherTelephone&#39;),
Choice(&#39;Pager&#39;), Choice(&#39;PrimaryPhone&#39;), Choice(&#39;RadioPhone&#39;), Choice(&#39;Telex&#39;), Choice(&#39;TtyTddPhone&#39;),
}, default=&#39;PrimaryPhone&#39;)
phone_number = SubField()
label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=&#39;PrimaryPhone&#39;)
phone_number = SubField(is_required=True)


class MultiFieldIndexedElement(IndexedElement, metaclass=EWSMeta):
Expand All @@ -83,10 +83,9 @@ <h1 class="title">Module <code>exchangelib.indexed_properties</code></h1>
&#34;&#34;&#34;MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/entry-physicaladdress&#34;&#34;&#34;

ELEMENT_NAME = &#39;Entry&#39;
LABEL_CHOICES = (&#39;Business&#39;, &#39;Home&#39;, &#39;Other&#39;)

label = LabelField(field_uri=&#39;Key&#39;, choices={
Choice(&#39;Business&#39;), Choice(&#39;Home&#39;), Choice(&#39;Other&#39;)
}, default=&#39;Business&#39;)
label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=LABEL_CHOICES[0])
street = NamedSubField(field_uri=&#39;Street&#39;) # Street, house number, etc.
city = NamedSubField(field_uri=&#39;City&#39;)
state = NamedSubField(field_uri=&#39;State&#39;)
Expand Down Expand Up @@ -125,7 +124,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
LABEL_CHOICES = (&#39;EmailAddress1&#39;, &#39;EmailAddress2&#39;, &#39;EmailAddress3&#39;)

label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=LABEL_CHOICES[0])
email = EmailSubField()</code></pre>
email = EmailSubField(is_required=True)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
Expand Down Expand Up @@ -184,7 +183,7 @@ <h3>Inherited members</h3>
<pre><code class="python">class IndexedElement(EWSElement, metaclass=EWSMeta):
&#34;&#34;&#34;Base class for all classes that implement an indexed element.&#34;&#34;&#34;

LABELS = set()</code></pre>
LABEL_CHOICES = ()</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
Expand All @@ -197,7 +196,7 @@ <h3>Subclasses</h3>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="exchangelib.indexed_properties.IndexedElement.LABELS"><code class="name">var <span class="ident">LABELS</span></code></dt>
<dt id="exchangelib.indexed_properties.IndexedElement.LABEL_CHOICES"><code class="name">var <span class="ident">LABEL_CHOICES</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
Expand Down Expand Up @@ -262,14 +261,14 @@ <h3>Inherited members</h3>
&#34;&#34;&#34;MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/entry-phonenumber&#34;&#34;&#34;

ELEMENT_NAME = &#39;Entry&#39;

label = LabelField(field_uri=&#39;Key&#39;, choices={
Choice(&#39;AssistantPhone&#39;), Choice(&#39;BusinessFax&#39;), Choice(&#39;BusinessPhone&#39;), Choice(&#39;BusinessPhone2&#39;),
Choice(&#39;Callback&#39;), Choice(&#39;CarPhone&#39;), Choice(&#39;CompanyMainPhone&#39;), Choice(&#39;HomeFax&#39;), Choice(&#39;HomePhone&#39;),
Choice(&#39;HomePhone2&#39;), Choice(&#39;Isdn&#39;), Choice(&#39;MobilePhone&#39;), Choice(&#39;OtherFax&#39;), Choice(&#39;OtherTelephone&#39;),
Choice(&#39;Pager&#39;), Choice(&#39;PrimaryPhone&#39;), Choice(&#39;RadioPhone&#39;), Choice(&#39;Telex&#39;), Choice(&#39;TtyTddPhone&#39;),
}, default=&#39;PrimaryPhone&#39;)
phone_number = SubField()</code></pre>
LABEL_CHOICES = (
&#39;AssistantPhone&#39;, &#39;BusinessFax&#39;, &#39;BusinessPhone&#39;, &#39;BusinessPhone2&#39;, &#39;Callback&#39;, &#39;CarPhone&#39;, &#39;CompanyMainPhone&#39;,
&#39;HomeFax&#39;, &#39;HomePhone&#39;, &#39;HomePhone2&#39;, &#39;Isdn&#39;, &#39;MobilePhone&#39;, &#39;OtherFax&#39;, &#39;OtherTelephone&#39;, &#39;Pager&#39;,
&#39;PrimaryPhone&#39;, &#39;RadioPhone&#39;, &#39;Telex&#39;, &#39;TtyTddPhone&#39;
)

label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=&#39;PrimaryPhone&#39;)
phone_number = SubField(is_required=True)</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
Expand All @@ -287,6 +286,10 @@ <h3>Class variables</h3>
<dd>
<div class="desc"></div>
</dd>
<dt id="exchangelib.indexed_properties.PhoneNumber.LABEL_CHOICES"><code class="name">var <span class="ident">LABEL_CHOICES</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
<h3>Instance variables</h3>
<dl>
Expand Down Expand Up @@ -325,10 +328,9 @@ <h3>Inherited members</h3>
&#34;&#34;&#34;MSDN: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/entry-physicaladdress&#34;&#34;&#34;

ELEMENT_NAME = &#39;Entry&#39;
LABEL_CHOICES = (&#39;Business&#39;, &#39;Home&#39;, &#39;Other&#39;)

label = LabelField(field_uri=&#39;Key&#39;, choices={
Choice(&#39;Business&#39;), Choice(&#39;Home&#39;), Choice(&#39;Other&#39;)
}, default=&#39;Business&#39;)
label = LabelField(field_uri=&#39;Key&#39;, choices={Choice(c) for c in LABEL_CHOICES}, default=LABEL_CHOICES[0])
street = NamedSubField(field_uri=&#39;Street&#39;) # Street, house number, etc.
city = NamedSubField(field_uri=&#39;City&#39;)
state = NamedSubField(field_uri=&#39;State&#39;)
Expand Down Expand Up @@ -356,6 +358,10 @@ <h3>Class variables</h3>
<dd>
<div class="desc"></div>
</dd>
<dt id="exchangelib.indexed_properties.PhysicalAddress.LABEL_CHOICES"><code class="name">var <span class="ident">LABEL_CHOICES</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
<h3>Instance variables</h3>
<dl>
Expand Down Expand Up @@ -505,7 +511,7 @@ <h4><code><a title="exchangelib.indexed_properties.EmailAddress" href="#exchange
<li>
<h4><code><a title="exchangelib.indexed_properties.IndexedElement" href="#exchangelib.indexed_properties.IndexedElement">IndexedElement</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.indexed_properties.IndexedElement.LABELS" href="#exchangelib.indexed_properties.IndexedElement.LABELS">LABELS</a></code></li>
<li><code><a title="exchangelib.indexed_properties.IndexedElement.LABEL_CHOICES" href="#exchangelib.indexed_properties.IndexedElement.LABEL_CHOICES">LABEL_CHOICES</a></code></li>
</ul>
</li>
<li>
Expand All @@ -516,6 +522,7 @@ <h4><code><a title="exchangelib.indexed_properties.PhoneNumber" href="#exchangel
<ul class="">
<li><code><a title="exchangelib.indexed_properties.PhoneNumber.ELEMENT_NAME" href="#exchangelib.indexed_properties.PhoneNumber.ELEMENT_NAME">ELEMENT_NAME</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhoneNumber.FIELDS" href="#exchangelib.indexed_properties.PhoneNumber.FIELDS">FIELDS</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhoneNumber.LABEL_CHOICES" href="#exchangelib.indexed_properties.PhoneNumber.LABEL_CHOICES">LABEL_CHOICES</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhoneNumber.label" href="#exchangelib.indexed_properties.PhoneNumber.label">label</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhoneNumber.phone_number" href="#exchangelib.indexed_properties.PhoneNumber.phone_number">phone_number</a></code></li>
</ul>
Expand All @@ -525,6 +532,7 @@ <h4><code><a title="exchangelib.indexed_properties.PhysicalAddress" href="#excha
<ul class="two-column">
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.ELEMENT_NAME" href="#exchangelib.indexed_properties.PhysicalAddress.ELEMENT_NAME">ELEMENT_NAME</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.FIELDS" href="#exchangelib.indexed_properties.PhysicalAddress.FIELDS">FIELDS</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.LABEL_CHOICES" href="#exchangelib.indexed_properties.PhysicalAddress.LABEL_CHOICES">LABEL_CHOICES</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.city" href="#exchangelib.indexed_properties.PhysicalAddress.city">city</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.clean" href="#exchangelib.indexed_properties.PhysicalAddress.clean">clean</a></code></li>
<li><code><a title="exchangelib.indexed_properties.PhysicalAddress.country" href="#exchangelib.indexed_properties.PhysicalAddress.country">country</a></code></li>
Expand Down
Loading

0 comments on commit 762819f

Please sign in to comment.