Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-dominate for openSUSE:Factory 
checked in at 2021-03-12 13:33:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dominate (Old)
 and      /work/SRC/openSUSE:Factory/.python-dominate.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dominate"

Fri Mar 12 13:33:28 2021 rev:6 rq:878439 version:2.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-dominate/python-dominate.changes  
2020-09-21 17:47:01.529116699 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-dominate.new.2401/python-dominate.changes    
    2021-03-12 13:33:29.950340937 +0100
@@ -1,0 +2,6 @@
+Fri Mar 12 04:08:22 UTC 2021 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 2.6.0:
+  * Add get_current() to return the current active element in a with context 
+
+-------------------------------------------------------------------

Old:
----
  dominate-2.5.2.tar.gz

New:
----
  dominate-2.6.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-dominate.spec ++++++
--- /var/tmp/diff_new_pack.jZzltD/_old  2021-03-12 13:33:32.022343843 +0100
+++ /var/tmp/diff_new_pack.jZzltD/_new  2021-03-12 13:33:32.026343848 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-dominate
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-dominate
-Version:        2.5.2
+Version:        2.6.0
 Release:        0
 Summary:        Python library for creating and manipulating HTML documents
 License:        GPL-3.0-only

++++++ dominate-2.5.2.tar.gz -> dominate-2.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/PKG-INFO new/dominate-2.6.0/PKG-INFO
--- old/dominate-2.5.2/PKG-INFO 2020-08-22 21:21:42.000000000 +0200
+++ new/dominate-2.6.0/PKG-INFO 2020-10-21 09:01:29.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dominate
-Version: 2.5.2
+Version: 2.6.0
 Summary: Dominate is a Python library for creating and manipulating HTML 
documents using an elegant DOM API.
 Home-page: https://github.com/Knio/dominate/
 Author: Tom Flanagan and Jake Wharton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate/_version.py 
new/dominate-2.6.0/dominate/_version.py
--- old/dominate-2.5.2/dominate/_version.py     2020-08-22 21:20:26.000000000 
+0200
+++ new/dominate-2.6.0/dominate/_version.py     2020-10-21 08:57:28.000000000 
+0200
@@ -1 +1 @@
-__version__ = '2.5.2'
+__version__ = '2.6.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate/dom_tag.py 
new/dominate-2.6.0/dominate/dom_tag.py
--- old/dominate-2.5.2/dominate/dom_tag.py      2020-08-22 21:18:41.000000000 
+0200
+++ new/dominate-2.6.0/dominate/dom_tag.py      2020-10-21 08:57:28.000000000 
+0200
@@ -43,6 +43,7 @@
 except ImportError:
   greenlet = None
 
+
 def _get_thread_context():
   context = [threading.current_thread()]
   if greenlet:
@@ -57,11 +58,11 @@
                      # modified
   is_inline = False
 
-  frame = namedtuple('frame', ['tag', 'items', 'used'])
 
   def __new__(_cls, *args, **kwargs):
     '''
-    Check if bare tag is being used a a decorator.
+    Check if bare tag is being used a a decorator
+    (called with a single function arg).
     decorate the function and return
     '''
     if len(args) == 1 and isinstance(args[0], Callable) \
@@ -75,6 +76,7 @@
       return f
     return object.__new__(_cls)
 
+
   def __init__(self, *args, **kwargs):
     '''
     Creates a new tag. Child tags should be passed as arguments and attributes
@@ -105,28 +107,35 @@
     self._ctx = None
     self._add_to_ctx()
 
-  def _add_to_ctx(self):
-    ctx = dom_tag._with_contexts[_get_thread_context()]
-    if ctx and ctx[-1]:
-      self._ctx = ctx[-1]
-      ctx[-1].items.append(self)
 
-  # stack of (root_tag, [new_tags], set(used_tags))
+  # context manager
+  frame = namedtuple('frame', ['tag', 'items', 'used'])
+  # stack of frames
   _with_contexts = defaultdict(list)
 
+  def _add_to_ctx(self):
+    stack = dom_tag._with_contexts.get(_get_thread_context())
+    if stack:
+      self._ctx = stack[-1]
+      stack[-1].items.append(self)
+
+
   def __enter__(self):
-    ctx = dom_tag._with_contexts[_get_thread_context()]
-    ctx.append(dom_tag.frame(self, [], set()))
+    stack = dom_tag._with_contexts[_get_thread_context()]
+    stack.append(dom_tag.frame(self, [], set()))
     return self
 
+
   def __exit__(self, type, value, traceback):
-    ctx = dom_tag._with_contexts[_get_thread_context()]
-    slf, items, used = ctx[-1]
-    ctx[-1] = None
-    for item in items:
-      if item in used: continue
+    thread_id = _get_thread_context()
+    stack = dom_tag._with_contexts[thread_id]
+    frame = stack.pop()
+    for item in frame.items:
+      if item in frame.used: continue
       self.add(item)
-    ctx.pop()
+    if not stack:
+      del dom_tag._with_contexts[thread_id]
+
 
   def __call__(self, func):
     '''
@@ -146,6 +155,7 @@
         return func(*args, **kwargs) or tag
     return f
 
+
   def set_attribute(self, key, value):
     '''
     Add or update the value of an attribute.
@@ -178,6 +188,7 @@
         if not isinstance(i, dom_tag): return
         i.setdocument(doc)
 
+
   def add(self, *args):
     '''
     Add new child tags.
@@ -192,9 +203,9 @@
         self.children.append(obj)
 
       elif isinstance(obj, dom_tag):
-        ctx = dom_tag._with_contexts[_get_thread_context()]
-        if ctx and ctx[-1]:
-          ctx[-1].used.add(obj)
+        stack = dom_tag._with_contexts.get(_get_thread_context())
+        if stack:
+          stack[-1].used.add(obj)
         self.children.append(obj)
         obj.parent = self
         obj.setdocument(self.document)
@@ -215,18 +226,22 @@
 
     return args
 
+
   def add_raw_string(self, s):
     self.children.append(s)
 
+
   def remove(self, obj):
     self.children.remove(obj)
 
+
   def clear(self):
     for i in self.children:
       if isinstance(i, dom_tag) and i.parent is self:
         i.parent = None
     self.children = []
 
+
   def get(self, tag=None, **kwargs):
     '''
     Recursively searches children for tags of a certain
@@ -253,6 +268,7 @@
         results.extend(child.get(tag, **kwargs))
     return results
 
+
   def __getitem__(self, key):
     '''
     Returns the stored value of the specified attribute or child
@@ -275,12 +291,14 @@
           'child tags and attributes, respectively.')
   __getattr__ = __getitem__
 
+
   def __len__(self):
     '''
     Number of child elements.
     '''
     return len(self.children)
 
+
   def __bool__(self):
     '''
     Hack for "if x" and __len__
@@ -288,12 +306,14 @@
     return True
   __nonzero__ = __bool__
 
+
   def __iter__(self):
     '''
     Iterates over child elements.
     '''
     return self.children.__iter__()
 
+
   def __contains__(self, item):
     '''
     Checks recursively if item is in children tree.
@@ -301,6 +321,7 @@
     '''
     return bool(self.get(item))
 
+
   def __iadd__(self, obj):
     '''
     Reflexive binary addition simply adds tag as a child.
@@ -313,10 +334,12 @@
     return self.render()
   __str__ = __unicode__
 
+
   def render(self, indent='  ', pretty=True, xhtml=False):
     data = self._render([], 0, indent, pretty, xhtml)
     return u''.join(data)
 
+
   def _render(self, sb, indent_level, indent_str, pretty, xhtml):
     pretty = pretty and self.is_pretty
 
@@ -365,6 +388,7 @@
 
     return inline
 
+
   def __repr__(self):
     name = '%s.%s' % (self.__module__, type(self).__name__)
 
@@ -432,18 +456,30 @@
     return (attribute, value)
 
 
+_get_current_none = object()
+def get_current(default=_get_current_none):
+  '''
+  get the current tag being used as a with context or decorated function.
+  if no context is active, raises ValueError, or returns the default, if 
provided
+  '''
+  h = _get_thread_context()
+  ctx = dom_tag._with_contexts.get(h, None)
+  if ctx:
+    return ctx[-1].tag
+  if default is _get_current_none:
+    raise ValueError('no current context')
+  return default
+
+
 def attr(*args, **kwargs):
   '''
   Set attributes on the current active tag context
   '''
-  ctx = dom_tag._with_contexts[_get_thread_context()]
-  if ctx and ctx[-1]:
-    dicts = args + (kwargs,)
-    for d in dicts:
-      for attr, value in d.items():
-        ctx[-1].tag.set_attribute(*dom_tag.clean_pair(attr, value))
-  else:
-    raise ValueError('not in a tag context')
+  c = get_current()
+  dicts = args + (kwargs,)
+  for d in dicts:
+    for attr, value in d.items():
+      c.set_attribute(*dom_tag.clean_pair(attr, value))
 
 
 # escape() is used in render
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate/tags.py 
new/dominate-2.6.0/dominate/tags.py
--- old/dominate-2.5.2/dominate/tags.py 2020-08-22 21:18:41.000000000 +0200
+++ new/dominate-2.6.0/dominate/tags.py 2020-10-21 08:57:28.000000000 +0200
@@ -18,7 +18,7 @@
 Public License along with Dominate.  If not, see
 <http://www.gnu.org/licenses/>.
 '''
-from .dom_tag  import dom_tag, attr
+from .dom_tag  import dom_tag, attr, get_current
 from .dom1core import dom1core
 
 try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate/util.py 
new/dominate-2.6.0/dominate/util.py
--- old/dominate-2.5.2/dominate/util.py 2020-03-07 06:09:56.000000000 +0100
+++ new/dominate-2.6.0/dominate/util.py 2020-10-21 08:57:28.000000000 +0200
@@ -21,8 +21,8 @@
 '''
 
 import re
-from .dom_tag import dom_tag
 
+from .dom_tag import dom_tag
 
 try:
   basestring = basestring
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate.egg-info/PKG-INFO 
new/dominate-2.6.0/dominate.egg-info/PKG-INFO
--- old/dominate-2.5.2/dominate.egg-info/PKG-INFO       2020-08-22 
21:21:42.000000000 +0200
+++ new/dominate-2.6.0/dominate.egg-info/PKG-INFO       2020-10-21 
09:01:29.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dominate
-Version: 2.5.2
+Version: 2.6.0
 Summary: Dominate is a Python library for creating and manipulating HTML 
documents using an elegant DOM API.
 Home-page: https://github.com/Knio/dominate/
 Author: Tom Flanagan and Jake Wharton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/dominate.egg-info/SOURCES.txt 
new/dominate-2.6.0/dominate.egg-info/SOURCES.txt
--- old/dominate-2.5.2/dominate.egg-info/SOURCES.txt    2020-08-22 
21:21:42.000000000 +0200
+++ new/dominate-2.6.0/dominate.egg-info/SOURCES.txt    2020-10-21 
09:01:29.000000000 +0200
@@ -17,6 +17,7 @@
 dominate.egg-info/top_level.txt
 tests/test_document.py
 tests/test_dom1core.py
+tests/test_dominate.py
 tests/test_html.py
 tests/test_svg.py
 tests/test_utils.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/tests/test_dominate.py 
new/dominate-2.6.0/tests/test_dominate.py
--- old/dominate-2.5.2/tests/test_dominate.py   1970-01-01 01:00:00.000000000 
+0100
+++ new/dominate-2.6.0/tests/test_dominate.py   2020-10-21 08:57:28.000000000 
+0200
@@ -0,0 +1,18 @@
+import pytest
+
+import dominate
+from dominate import tags
+from dominate import util
+
+def test_version():
+  import dominate
+  version = '2.6.0'
+  assert dominate.version == version
+  assert dominate.__version__ == version
+
+
+def test_context():
+  id1 = dominate.dom_tag._get_thread_context()
+  id2 = dominate.dom_tag._get_thread_context()
+  assert id1 == id2
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/tests/test_html.py 
new/dominate-2.6.0/tests/test_html.py
--- old/dominate-2.5.2/tests/test_html.py       2020-08-22 21:20:51.000000000 
+0200
+++ new/dominate-2.6.0/tests/test_html.py       2020-10-21 08:57:28.000000000 
+0200
@@ -1,3 +1,4 @@
+import dominate
 from dominate.tags import *
 import pytest
 
@@ -6,12 +7,6 @@
 except NameError:
   xrange = range
 
-def test_version():
-  import dominate
-  version = '2.5.2'
-  assert dominate.version == version
-  assert dominate.__version__ == version
-
 
 def test_arguments():
   assert html(body(h1('Hello, pyy!'))).render() == \
@@ -29,7 +24,7 @@
     cls="mydiv",
     data_name='foo',
     onclick='alert(1);').render() == \
-'''<div checked="checked" class="mydiv" data-name="foo" id="4" 
onclick="alert(1);"></div>'''
+  '''<div checked="checked" class="mydiv" data-name="foo" id="4" 
onclick="alert(1);"></div>'''
 
 
 def test_repr():
@@ -77,15 +72,15 @@
 </ul>'''
 
 
-# copy rest of examples here
-
-
 def test_context_manager():
+  other = div()
   h = ul()
   with h:
     li('One')
     li('Two')
     li('Three')
+    # added to other, so not added to h
+    other += li('Four')
 
   assert h.render() == \
 '''<ul>
@@ -186,6 +181,22 @@
 <pre>&lt;&gt;</pre>'''
 
 
+def test_get_context():
+  with pytest.raises(ValueError):
+    d = get_current()
+
+  d = get_current(None)
+  assert d is None
+
+  with div() as d1:
+    d2 = span()
+    with d2:
+      d2p = get_current()
+    d1p = get_current()
+  assert d1 is d1p
+  assert d2 is d2p
+
+
 def test_attributes():
   d = div()
   d['id'] = 'foo'
@@ -248,6 +259,14 @@
   assert d.render() == '<!--Hi there-->'
   assert div(d).render() == '<div>\n  <!--Hi there-->\n</div>'
 
+  d = comment('Hi ie user', condition='IE 6')
+  assert d.render() == '<!--[if IE 6]>Hi ie user<![endif]-->'
+
+  d = comment(div('Hi non-ie user'), condition='!IE', downlevel='revealed')
+  assert d.render() == '''<![if !IE]>
+<div>Hi non-ie user</div>
+<![endif]>'''
+
 
 def test_boolean_attributes():
   assert input_(type="checkbox", checked=True).render() == \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dominate-2.5.2/tests/test_utils.py 
new/dominate-2.6.0/tests/test_utils.py
--- old/dominate-2.5.2/tests/test_utils.py      2018-09-25 04:45:41.000000000 
+0200
+++ new/dominate-2.6.0/tests/test_utils.py      2020-10-21 08:57:28.000000000 
+0200
@@ -1,6 +1,9 @@
+import pytest
+
 from dominate.tags import *
 from dominate import util
 
+
 def test_include():
   import os
   try:
@@ -18,6 +21,7 @@
     except:
       pass
 
+
 def test_system():
   d = div()
   d += util.system('echo Hello World')
@@ -27,6 +31,7 @@
 def test_unescape():
   assert util.unescape('&amp;&lt;&gt;&#32;') == '&<> '
 
+
 def test_url():
   assert util.url_escape('hi there?') == 'hi%20there%3F'
-  assert util.url_unescape('hi%20there%3f') == 'hi there?'
\ No newline at end of file
+  assert util.url_unescape('hi%20there%3f') == 'hi there?'

Reply via email to