commit python-dslib for openSUSE:Factory
Hello community, here is the log from the commit of package python-dslib for openSUSE:Factory checked in at 2014-09-30 19:40:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dslib (Old) and /work/SRC/openSUSE:Factory/.python-dslib.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-dslib" Changes: -------- --- /work/SRC/openSUSE:Factory/python-dslib/python-dslib.changes 2013-10-25 11:14:35.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-dslib.new/python-dslib.changes 2014-09-30 19:41:49.000000000 +0200 @@ -1,0 +2,5 @@ +Mon Sep 15 14:17:16 UTC 2014 - tchvatal@suse.com + +- Version bump to 3.1 to work with newest datovka. + +------------------------------------------------------------------- Old: ---- dslib-3.0.tar.gz New: ---- dslib-3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dslib.spec ++++++ --- /var/tmp/diff_new_pack.ctfVcv/_old 2014-09-30 19:41:50.000000000 +0200 +++ /var/tmp/diff_new_pack.ctfVcv/_new 2014-09-30 19:41:50.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-dslib # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,8 +16,13 @@ # +%if 0%{?suse_version} && 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%else +BuildArch: noarch +%endif Name: python-dslib -Version: 3.0 +Version: 3.1 Release: 0 Summary: Library to access Czech eGov system \"Datove schranky\" License: LGPL-2.0+ @@ -35,12 +40,7 @@ Requires: python-pyasn1 >= 0.0.13 Requires: python-sudsds BuildRoot: %{_tmppath}/%{name}-%{version}-build -%py_requires -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else -BuildArch: noarch -%endif +%{py_requires} %description A library for accessing ISDS (Informační system datovych schranek/ @@ -54,7 +54,7 @@ python setup.py build %install -python setup.py install --prefix=%{_prefix} --optimize=2 --root="%{buildroot}" +python setup.py install --prefix=%{_prefix} --optimize=2 --root=%{buildroot} rm %{buildroot}/%{_datadir}/dslib/{README,LICENSE}.txt %fdupes %{buildroot} ++++++ dslib-3.0.tar.gz -> dslib-3.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/PKG-INFO new/dslib-3.1/PKG-INFO --- old/dslib-3.0/PKG-INFO 2012-12-19 15:38:39.000000000 +0100 +++ new/dslib-3.1/PKG-INFO 2014-06-04 21:05:01.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: dslib -Version: 3.0 +Version: 3.1 Summary: dslib is a free Python library for accessing Datove schranky Home-page: http://labs.nic.cz/datove-schranky/ Author: CZ.NIC Labs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/dsdb/alchemy.py new/dslib-3.1/dsdb/alchemy.py --- old/dslib-3.0/dsdb/alchemy.py 2012-10-24 09:35:21.000000000 +0200 +++ new/dslib-3.1/dsdb/alchemy.py 2014-05-20 14:50:44.000000000 +0200 @@ -25,6 +25,7 @@ import sqlalchemy as sal import sqlalchemy.orm as salorm from sqlalchemy.sql import between +from sqlalchemy.engine import reflection # dslib imports from dslib.client import Client @@ -36,27 +37,35 @@ from abstract import AbstractDSDatabase MESSAGE_TYPE_RECEIVED = 1 -MESSAGE_TYPE_SENT = 2 +MESSAGE_TYPE_SENT = 2 class Binding(object): model = None table_name = None columns = [] + indexes = [] def __init__(self): self.table = None - def create_table(self, engine, metadata): - self.table = sal.Table(self.table_name, metadata, *self.get_columns()) - metadata.create_all(engine) + def create_table(self, metadata): + self.table = sal.Table(self.table_name, metadata, + *(self.get_columns() + self.get_indexes())) def bind_model(self, map_props=None): if self.model: if map_props is None: map_props = {} salorm.mapper(self.model, self.table, properties=map_props) - + + @classmethod + def get_indexes(cls): + index_list = [] + for idx_name, idx_cols in cls.indexes: + index_list.append(sal.Index(idx_name, *idx_cols)) + return index_list + class MessageBinding(Binding): @@ -70,7 +79,8 @@ model = Message table_name = 'messages' - + indexes = [("idx_messages_deltime", ("dmDeliveryTime",))] + @classmethod def get_columns(cls): return [sal.Column('dmID', sal.Integer, primary_key=True), @@ -79,24 +89,29 @@ ] + \ [sal.Column(name, cls._type_map.get(name, sal.Text), nullable=True) for name in Message.KNOWN_ATTRS - if name!='dmID' and name not in Message.ATTR_TO_TYPE and name!='dmHash'] + if name != 'dmID' and name not in Message.ATTR_TO_TYPE and name != 'dmHash'] class dmFileBinding(Binding): model = dmFile table_name = 'files' + indexes = [("idx_files_msgid", ("message_id",))] + @classmethod def get_columns(cls): return [sal.Column('id', sal.Integer, primary_key=True), sal.Column('message_id', sal.Integer, sal.ForeignKey("messages.dmID"))] + \ [sal.Column(name, sal.Text, nullable=True) for name in cls.model.KNOWN_ATTRS] - + + class dmHashBinding(Binding): model = dmHash table_name = 'hashes' + indexes = [("idx_hashes_msgid", ("message_id",))] + @classmethod def get_columns(cls): return [sal.Column('id', sal.Integer, primary_key=True), @@ -108,6 +123,8 @@ model = dmEvent table_name = 'events' + indexes = [("idx_events_msgid", ("message_id",))] + @classmethod def get_columns(cls): return [sal.Column('id', sal.Integer, primary_key=True), @@ -118,12 +135,12 @@ # ---- Additional models and bindings not inherited from dslib ---- class RawMessageData(object): - + def __init__(self, dmID, message_type, data): self.message_id = dmID self.message_type = message_type self.data = data - + class RawMessageDataBinding(Binding): model = RawMessageData @@ -138,7 +155,7 @@ # delivery info data class RawDeliveryInfoData(object): - + def __init__(self, dmID, data): self.message_id = dmID self.data = data @@ -155,7 +172,7 @@ class SupplementaryMessageData(object): - + def __init__(self, dmID, type=MESSAGE_TYPE_RECEIVED, read_locally=False, data=None, download_date=None): self.message_id = dmID @@ -163,19 +180,21 @@ self.read_locally = read_locally self.download_date = download_date self.custom_data = data - + def set_custom_data(self, data): self.custom_data = json.dumps(data) - + def get_custom_data(self): if self.custom_data: return json.loads(self.custom_data) return {} - + class SupplementaryMessageDataBinding(Binding): model = SupplementaryMessageData table_name = 'supplementary_message_data' + indexes = [("idx_supplementary_message_data_msgtype", ("message_type",))] + @classmethod def get_columns(cls): return [sal.Column('message_id', sal.Integer, @@ -187,14 +206,14 @@ ] class CertificateData(object): - + def __init__(self, der_data, id=None): self.id = id self.der_data = base64.b64encode(der_data) - + def get_der_data(self): return base64.b64decode(self.der_data) - + class CertificateDataBinding(Binding): model = CertificateData @@ -205,8 +224,10 @@ sal.Column('der_data', sal.Text, unique=True)] class MessageToCertificateData(Binding): - + table_name = 'message_certificate_data' + indexes = [("idx_message_certificate_data_msgid", ("message_id",))] + @classmethod def get_columns(cls): return [sal.Column('message_id', sal.Integer, sal.ForeignKey('messages.dmID')), @@ -227,35 +248,36 @@ return new class DSDatabase(AbstractDSDatabase): - + DEBUG = False - + binding_cls = [MessageBinding, dmFileBinding, dmHashBinding, dmEventBinding, RawMessageDataBinding, RawDeliveryInfoDataBinding, SupplementaryMessageDataBinding, CertificateDataBinding, ] - + def __init__(self): super(DSDatabase, self).__init__() self.engine = None self.session = None self.metadata = None self.bindings = [bcls() for bcls in self.binding_cls] - self.mess_to_cert = MessageToCertificateData() - self._supp_data_cache = {} + self.mess_to_cert = MessageToCertificateData() + self._supp_data_cache = {} + - def open_database(self, filename=None): """should open the database. Filename is the name of the sqlite db""" self.metadata = sal.MetaData() if filename: - self.engine = sal.create_engine('sqlite:///%s'%filename, echo=self.DEBUG) + self.engine = sal.create_engine('sqlite:///%s?check_same_thread=False' % filename, echo=self.DEBUG) else: - self.engine = sal.create_engine('sqlite:///:memory:', echo=self.DEBUG) + self.engine = sal.create_engine('sqlite:///:memory:?check_same_thread=False', echo=self.DEBUG) for binding in self.bindings: - binding.create_table(self.engine, self.metadata) - self.mess_to_cert.create_table(self.engine, self.metadata) + binding.create_table(self.metadata) + self.mess_to_cert.create_table(self.metadata) + self.metadata.create_all(self.engine) for binding in self.bindings: if isinstance(binding, MessageBinding): props = {'certificate_data': salorm.relation(CertificateData, @@ -264,32 +286,24 @@ else: props = None binding.bind_model(map_props=props) - self._new_session() - - def _new_session(self): - self.session = salorm.sessionmaker(bind=self.engine)() - self._session_thread = thread.get_ident() - - def _close_session(self): - self.session.close() - self.session = None + self.session = salorm.scoped_session(salorm.sessionmaker(bind=self.engine)) def close_database(self): sal.orm.clear_mappers() self.engine.dispose() - - @thread_safe_session + + # @thread_safe_session def list_message_ids(self): for id in self.session.query(Message.dmID).all(): yield id[0] - @thread_safe_session + # @thread_safe_session def all_messages(self): for m in self.messages_between_dates(None, None): yield m - - @thread_safe_session + + # @thread_safe_session def store_message(self, message, raw_data=None, typ=None, read_locally=None, custom_data=None): # translate type from string if needed @@ -338,13 +352,13 @@ self.session.add(sd) # commit the data self.session.commit() - - @thread_safe_session + + # @thread_safe_session def get_message(self, id, omit_relations=False): """return message by its id""" m, sup = self.session.query(Message, SupplementaryMessageData).\ - filter(Message.dmID==SupplementaryMessageData.message_id).\ - filter(Message.dmID==int(id)).first() + filter(Message.dmID == SupplementaryMessageData.message_id).\ + filter(Message.dmID == int(id)).first() if sup: m.message_type = sup.message_type m.read_locally = sup.read_locally @@ -355,15 +369,15 @@ if m: self.add_pkcs7_data(m) return m - - @thread_safe_session + + # @thread_safe_session def messages_between_dates(self, from_date, to_date, message_type=None, add_pkcs7_data=False): """generator yielding messages with dmDeliveryTime between certain dates""" query = self.session.query(Message, SupplementaryMessageData).\ - filter(Message.dmID==SupplementaryMessageData.message_id) + filter(Message.dmID == SupplementaryMessageData.message_id) if message_type: - query = query.filter(SupplementaryMessageData.message_type==message_type) + query = query.filter(SupplementaryMessageData.message_type == message_type) if to_date and not from_date: ms = query.filter(Message.dmDeliveryTime < to_date) elif from_date and not to_date: @@ -378,8 +392,8 @@ if add_pkcs7_data: self.add_pkcs7_data(m) yield m - - @thread_safe_session + + # @thread_safe_session def get_messages_between_dates(self, from_date, to_date, message_type=None, add_pkcs7_data=False): """return messages with dmDeliveryTime between certain dates""" @@ -387,14 +401,14 @@ add_pkcs7_data)) return ret - @thread_safe_session + # @thread_safe_session def get_messages_without_date(self, message_type=None, add_pkcs7_data=False): """return messages with empty dmDeliveryTime""" query = self.session.query(Message, SupplementaryMessageData).\ - filter(Message.dmID==SupplementaryMessageData.message_id).\ + filter(Message.dmID == SupplementaryMessageData.message_id).\ filter(Message.dmDeliveryTime == None) if message_type: - query = query.filter(SupplementaryMessageData.message_type==message_type) + query = query.filter(SupplementaryMessageData.message_type == message_type) ret = [] for m, supp in query: m.read_locally = supp.read_locally @@ -404,14 +418,14 @@ ret.append(m) return ret - @thread_safe_session + # @thread_safe_session def add_pkcs7_data(self, message): p = PKCS7_data() p.certificates = [CertificateManager.get_certificate_from_der(c.get_der_data())\ for c in message.certificate_data] message.pkcs7_data = p - @thread_safe_session + # @thread_safe_session def add_delivery_info_data(self, mid, delivery_info, raw_data=None): """merges additional data from delivery info into the message and stores raw data into the database if given""" @@ -426,22 +440,22 @@ self.session.add(event) self.session.commit() - @thread_safe_session + # @thread_safe_session def has_message(self, id): assert self.session return bool(self.session.query(Message).get(int(id))) - @thread_safe_session + # @thread_safe_session def has_raw_data(self, id): assert self.session return bool(self.session.query(RawMessageData).get(int(id))) - - @thread_safe_session + + # @thread_safe_session def has_raw_delivery_info_data(self, id): assert self.session return bool(self.session.query(RawDeliveryInfoData).get(int(id))) - @thread_safe_session + # @thread_safe_session def remove_message(self, id): for m in self.session.query(Message).filter_by(dmID=int(id)): self.session.delete(m) @@ -450,12 +464,12 @@ self.session.delete(m) self.session.commit() - @thread_safe_session + # @thread_safe_session def store_raw_data(self, rd): self.session.add(rd) self.session.commit() - @thread_safe_session + # @thread_safe_session def get_message_from_raw_data(self, id, client): rd = self.get_raw_data(id) if rd.message_type == MESSAGE_TYPE_RECEIVED: @@ -464,43 +478,43 @@ method = "SignedSentMessageDownload" message = client.signature_to_message(rd.data, method) return message - - @thread_safe_session + + # @thread_safe_session def get_delivery_info_from_raw_data(self, id, client): rd = self.get_raw_delivery_info_data(id) method = "GetSignedDeliveryInfo" di = client.signature_to_delivery_info(rd.data, method) return di - - @thread_safe_session + + # @thread_safe_session def get_raw_data(self, id): rd = self.session.query(RawMessageData).get(id) if not rd: - raise ValueError("RawMessageData with id '%d' does not exist."%id) + raise ValueError("RawMessageData with id '%d' does not exist." % id) return rd - - @thread_safe_session + + # @thread_safe_session def get_raw_delivery_info_data(self, id): rd = self.session.query(RawDeliveryInfoData).get(id) if not rd: - raise ValueError("RawDeliveryInfoData with id '%d' does not exist."%id) + raise ValueError("RawDeliveryInfoData with id '%d' does not exist." % id) return rd - - @thread_safe_session + + # @thread_safe_session def store_supplementary_data(self, sd): self.session.add(sd) self.session.commit() - @thread_safe_session + # @thread_safe_session def has_supplementary_data(self, id): assert self.session return bool(self.session.query(SupplementaryMessageData).get(int(id))) - @thread_safe_session + # @thread_safe_session def get_supplementary_data(self, id): return self.session.query(SupplementaryMessageData).get(int(id)) - - @thread_safe_session + + # @thread_safe_session def get_unique_senders(self): ret = list(self.session.query(Message.dbIDSender, Message.dmSender, Message.dmSenderAddress)\ @@ -508,8 +522,8 @@ .filter_by(message_type=MESSAGE_TYPE_RECEIVED)\ .distinct()) return ret - - @thread_safe_session + + # @thread_safe_session def get_unique_recipients(self): ret = list(self.session.query(Message.dbIDRecipient, Message.dmRecipient, Message.dmRecipientAddress)\ @@ -517,8 +531,8 @@ .filter_by(message_type=MESSAGE_TYPE_SENT)\ .distinct()) return ret - - @thread_safe_session + + # @thread_safe_session def mark_messages_as_read_locally(self, mids): """mids is a list of message ids that should be marked as read_locally""" #ex = sal.update(SupplementaryMessageData)\ @@ -528,4 +542,3 @@ .filter(SupplementaryMessageData.message_id.in_(mids))\ .update({"read_locally": True}, synchronize_session=False) self.session.commit() - \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/dslib.egg-info/PKG-INFO new/dslib-3.1/dslib.egg-info/PKG-INFO --- old/dslib-3.0/dslib.egg-info/PKG-INFO 2012-12-19 15:38:38.000000000 +0100 +++ new/dslib-3.1/dslib.egg-info/PKG-INFO 2014-06-04 21:05:00.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: dslib -Version: 3.0 +Version: 3.1 Summary: dslib is a free Python library for accessing Datove schranky Home-page: http://labs.nic.cz/datove-schranky/ Author: CZ.NIC Labs diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/dslib.egg-info/SOURCES.txt new/dslib-3.1/dslib.egg-info/SOURCES.txt --- old/dslib-3.0/dslib.egg-info/SOURCES.txt 2012-12-19 15:38:39.000000000 +0100 +++ new/dslib-3.1/dslib.egg-info/SOURCES.txt 2014-06-04 21:05:01.000000000 +0200 @@ -50,37 +50,11 @@ ./pkcs7/asn1_models/tools.py ./properties/__init__.py ./properties/properties.py -converters/__init__.py -converters/bytes_converter.py -dsdb/__init__.py -dsdb/abstract.py -dsdb/alchemy.py dslib.egg-info/PKG-INFO dslib.egg-info/SOURCES.txt dslib.egg-info/dependency_links.txt dslib.egg-info/requires.txt dslib.egg-info/top_level.txt -pkcs7/__init__.py -pkcs7/debug.py -pkcs7/digest.py -pkcs7/pkcs7_decoder.py -pkcs7/rsa_verifier.py -pkcs7/tstamp_helper.py -pkcs7/verifier.py -pkcs7/asn1_models/RSA.py -pkcs7/asn1_models/TST_info.py -pkcs7/asn1_models/X509_certificate.py -pkcs7/asn1_models/__init__.py -pkcs7/asn1_models/att_certificate_v2.py -pkcs7/asn1_models/certificate_extensions.py -pkcs7/asn1_models/crl.py -pkcs7/asn1_models/digest_info.py -pkcs7/asn1_models/general_types.py -pkcs7/asn1_models/oid.py -pkcs7/asn1_models/pkcs_signed_data.py -pkcs7/asn1_models/tools.py -properties/__init__.py -properties/properties.py trusted_certificates/all_trusted.pem trusted_certificates/postsignum_qca2_root.pem trusted_certificates/postsignum_qca2_sub.pem diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/release.py new/dslib-3.1/release.py --- old/dslib-3.0/release.py 2012-12-18 13:39:20.000000000 +0100 +++ new/dslib-3.1/release.py 2014-05-20 14:50:44.000000000 +0200 @@ -16,4 +16,4 @@ #* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #* -DSLIB_VERSION="3.0" +DSLIB_VERSION="3.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/stdeb.cfg new/dslib-3.1/stdeb.cfg --- old/dslib-3.0/stdeb.cfg 2012-12-19 15:38:23.000000000 +0100 +++ new/dslib-3.1/stdeb.cfg 2014-05-27 20:08:09.000000000 +0200 @@ -1,3 +1,3 @@ [DEFAULT] -Depends: python-openssl (>=0.9), python-sudsds (>=1.0.1), python-pyasn1 (>=0.0.13) +Depends: python-openssl (>=0.9), python-sudsds (>=1.0.1), python-pyasn1 (>=0.0.13), python-sqlalchemy (>=0.8) XS-Python-Version: >= 2.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dslib-3.0/tests.py new/dslib-3.1/tests.py --- old/dslib-3.0/tests.py 2012-10-24 14:41:47.000000000 +0200 +++ new/dslib-3.1/tests.py 2014-05-20 14:50:44.000000000 +0200 @@ -163,14 +163,15 @@ @active def CreateMessage(): envelope = models.dmEnvelope() - envelope.dbIDRecipient = "hjyaavk" + envelope.dbIDRecipient = "4nwahuq" envelope.dmAnnotation = "tohle je dalsi pokus posilany z pythonu" dmfile = models.dmFile() dmfile._dmMimeType = "text/plain" dmfile._dmFileMetaType = "main" - dmfile._dmFileDescr = "prilozeny_soubor.txt" + dmfile._dmFileDescr = "prilozeny_soubor_s/lomitkem/v/nazvu.txt" import base64 - dmfile.dmEncodedContent = base64.standard_b64encode("tohle je pokusny text v pokusne priloze") + dmfile.dmEncodedContent = base64.standard_b64encode("tohle je pokusny text v" + " pokusne priloze") dmfiles = [dmfile] reply = ds_client.CreateMessage(envelope, dmfiles) print reply.status -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de