Re: Generating HTML

2013-07-29 Thread Burak Arslan
Hi, On 07/29/13 14:41, Morten Guldager wrote: Something like: table_struct = ['table', ['tr', ['td', {class=red}, this is red],['td', {class=blue}, this is not red]]] html = struct2html(table_struct) Suggestions? See: http://lxml.de/lxmlhtml.html#creating-html-with-the-e-factory

Re: Newbie: static typing?

2013-08-06 Thread Burak Arslan
On 08/06/13 13:12, Rui Maciel wrote: Joshua Landau wrote: What's the actual problem you're facing? Where do you feel that you need to verify types? A standard case would be when there's a function which is designed expecting that all operands support a specific interface or contain specific

Re: Working with XML/XSD

2013-08-06 Thread Burak Arslan
On 08/06/13 01:56, David Barroso wrote: Hello, I was wondering if someone could point me in the right direction. I would like to develop some scripts to manage Cisco routers and switches using XML. However, I am not sure where to start. Does someone have some experience working with XML,

Re: Language design

2013-09-11 Thread Burak Arslan
On 09/10/13 09:09, Steven D'Aprano wrote: What design mistakes, traps or gotchas do you think Python has? My favourite gotcha is this: elt, = elts It's a nice and compact way to do both: assert len(elts) == 0 elt = elts[0] but it sure looks strange at first sight. As a bonus, it

Re: Language design

2013-09-11 Thread Burak Arslan
On 09/11/13 17:52, Ethan Furman wrote: On 09/11/2013 03:38 AM, Burak Arslan wrote: On 09/10/13 09:09, Steven D'Aprano wrote: What design mistakes, traps or gotchas do you think Python has? My favourite gotcha is this: elt, = elts It's a nice and compact way to do both: assert

Re: lxml question -- creating an etree.Element attribute with ':' in the name

2013-09-18 Thread Burak Arslan
On 09/18/13 21:59, Roy Smith wrote: I can create an Element with a 'foo' attribute by doing: etree.Element('my_node_name', foo=spam) But, how do I handle something like: xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;, since xmlns:xsi isn't a valid python identifier? xmlns: is a

Re: Try-except for flow control in reading Sqlite

2013-10-28 Thread Burak Arslan
On 10/28/13 05:43, Victor Hooi wrote: Hi, I'd like to double-check something regarding using try-except for controlling flow. I have a script that needs to lookup things in a SQLite database. If the SQLite database file doesn't exist, I'd like to create an empty database, and then setup

Bootstrapping a test environment

2013-12-17 Thread Burak Arslan
Hello list, I decided to set up a portable Jenkins environment for an open source project I'm working on. After a couple of hours of tinkering, I ended up with this: https://github.com/arskom/spyne/blob/05f7a08489e6dc04a3b5659eb325390bea13b2ff/run_tests.sh (it should have been a Makefile) This

outsmarting context managers with coroutines

2013-12-28 Thread Burak Arslan
Hi, Have a look at the following code snippets: https://gist.github.com/plq/8164035 Observations: output2: I can break out of outer context without closing the inner one in Python 2 output3: Breaking out of outer context closes the inner one, but the closing order is wrong. output3-yf: With

Re: outsmarting context managers with coroutines

2013-12-28 Thread Burak Arslan
On 12/29/13 00:13, Burak Arslan wrote: Hi, Have a look at the following code snippets: https://gist.github.com/plq/8164035 Observations: output2: I can break out of outer context without closing the inner one in Python 2 output3: Breaking out of outer context closes the inner one

Re: outsmarting context managers with coroutines

2013-12-29 Thread Burak Arslan
On 12/29/13 07:06, Ian Kelly wrote: On Sat, Dec 28, 2013 at 5:35 PM, Burak Arslan burak.ars...@arskom.com.tr wrote: On 12/29/13 00:13, Burak Arslan wrote: Hi, Have a look at the following code snippets: https://gist.github.com/plq/8164035 Observations: output2: I can break out of outer

Re: Python declarative

2014-01-24 Thread Burak Arslan
On 01/24/14 11:21, Frank Millman wrote: I store database metadata in the database itself. I have a table that defines each table in the database, and I have a table that defines each column. Column definitions include information such as data type, allow null, allow amend, maximum length,

Re: Wikipedia XML Dump

2014-01-28 Thread Burak Arslan
hi, On 01/29/14 00:31, Kevin Glover wrote: Thanks for the comments, guys. The Wikipedia download is a single XML document, 43.1GB. Any further thoughts? in that case, http://lxml.de/tutorial.html#event-driven-parsing seems to be your only option. hth, burak --

Re: Soap list and soap users on this list

2014-04-28 Thread Burak Arslan
Hi Joseph, Sorry for the late response, I seem to have missed this post. On 04/17/14 21:34, Joseph L. Casale wrote: I've been looking at Spyne to produce a service that can accept a request formatted as follows: ?xml version='1.0' encoding='UTF-8'? SOAP-ENV:Envelope

Re: Add Received: header to email msg in correct position?

2014-05-06 Thread Burak Arslan
On 05/06/14 12:47, Chris Angelico wrote: On Tue, May 6, 2014 at 7:15 PM, alister alister.nospam.w...@ntlworld.com wrote: On Mon, 05 May 2014 19:51:15 +, Grant Edwards wrote: I'm working on a Python app that receives an e-mail message via SMTP, does some trivial processing on it, and

Re: Add Received: header to email msg in correct position?

2014-05-07 Thread Burak Arslan
On 05/06/14 18:26, Grant Edwards wrote: On 2014-05-06, Burak Arslan burak.ars...@arskom.com.tr wrote: On 05/06/14 12:47, Chris Angelico wrote: On Tue, May 6, 2014 at 7:15 PM, alister alister.nospam.w...@ntlworld.com wrote: On Mon, 05 May 2014 19:51:15 +, Grant Edwards wrote: I'm

Re: parsing multiple root element XML into text

2014-05-09 Thread Burak Arslan
On 05/09/14 16:55, Stefan Behnel wrote: ElementTree has gained a nice API in Py3.4 that supports this in a much saner way than SAX, using iterators. Basically, you just dump in some data that you received and get back an iterator over the elements (and their subtrees) that it generated from

Re: Python CGI

2014-05-19 Thread Burak Arslan
On 05/19/14 21:32, Christian wrote: Hi, I'd like to use Python for CGI-Scripts. Is there a manual how to setup Python with Fast-CGI? Look for Mailman fastcgi guides. Here's one for gentoo, but I imagine it'd be easily applicable to other disros:

Re: Code a web service with python/postgis

2014-05-21 Thread Burak Arslan
On 05/20/14 21:10, lcel...@latitude-geosystems.com wrote: Dear all, I would like code a web service with python. I have already imported several vector data (land cover) and one Digital Elevation Model (raster layer) into my postgresql/postgis database (server side). I succeed in

Re: Verify JSON Data

2014-05-26 Thread Burak Arslan
On 26/05/14 16:26, gaurangns...@gmail.com wrote: Hi Guys, Would someone let me know how to verify JSON data in python. There are so many modules available to verify XML file, however i didn't find any good module to verify JSON Data. Hi, Spyne re-implements (a useful subset of) Xml Schema

Re: Suds and Python3

2014-06-01 Thread Burak Arslan
Hello, First, for such questions, there's always s...@python.org On 31/05/14 21:59, Paul McNett wrote: On 5/31/14, 11:36 AM, tokib...@gmail.com wrote: Suds is defacto python SOAP client, but it does not mainte recent few years. Why? The original authors don't seem to care anymore. If you

Re: Benefits of asyncio

2014-06-02 Thread Burak Arslan
On 06/02/14 20:40, Aseem Bansal wrote: I read in these groups that asyncio is a great addition to Python 3. I have looked around and saw the related PEP which is quite big BTW but couldn't find a simple explanation for why this is such a great addition. Any simple example where it can be

Re: Benefits of asyncio

2014-06-03 Thread Burak Arslan
On 06/03/14 12:30, Chris Angelico wrote: Write me a purely nonblocking web site concept that can handle a million concurrent connections, where each one requires one query against the database, and one in a hundred of them require five queries which happen atomically. I don't see why that

Re: Benefits of asyncio

2014-06-03 Thread Burak Arslan
On 03/06/14 14:57, Chris Angelico wrote: On Tue, Jun 3, 2014 at 9:05 PM, Burak Arslan burak.ars...@arskom.com.tr wrote: On 06/03/14 12:30, Chris Angelico wrote: Write me a purely nonblocking web site concept that can handle a million concurrent connections, where each one requires one query

Re: Distributing python applications as a zip file

2014-07-23 Thread Burak Arslan
On 07/23/14 07:23, Steven D'Aprano wrote: A little known feature of Python: you can wrap your Python application in a zip file and distribute it as a single file. The trick to make it runnable is to put your main function inside a file called __main__.py inside the zip file. Here's a basic

Re: Python vs C++

2014-08-21 Thread Burak Arslan
On 08/21/14 15:54, David Palao wrote: But I'm interested in a genuine C++ project: some task where C++ is really THE language (and where python is actually a bad ab initio choice) For my day job, I chose Qt on C++ for a classic desktop app that needs to be deployed on Windows (among other

Re: Passing soap response to python script

2013-04-05 Thread Burak Arslan
Hello, On 04/05/13 12:52, Ombongi Moraa Fe wrote: Hello Group, I am newbie to python and getting my way around. However, my first project that introduced me to the language deals with SOAP requests. Before going any further, there's a project called suds which implements a soap client. If

Re: Parsing soap result

2013-04-17 Thread Burak Arslan
On 04/17/13 16:50, Ombongi Moraa Fe wrote: My client.service.gere(ri) method call logs the below soap response in my log file. ?xml version=1.0 encoding=utf-8 ?soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;

Re: Parsing soap result

2013-04-18 Thread Burak Arslan
Hi, On 04/18/13 13:46, Ombongi Moraa Fe wrote: Hi Burak, Team, Apparently I was too deep in answering support questions for my company :) This is python-list, so It's just me here :) Your solution worked perfectly thanks. Could you share the logic of this solution? You're using

Re: serialize a class to XML and back

2013-05-23 Thread Burak Arslan
On 05/23/13 13:37, Schneider wrote: Hi list, how can I serialize a python class to XML? Plus a way to get the class back from the XML? My aim is to store instances of this class in a database. Hi, I'm working on a project called Spyne (http://spyne.io). With one object definition, you

Re: Must we include urllib just to decode a URL-encoded string, when using Requests?

2013-06-13 Thread Burak Arslan
On 06/13/13 16:25, Dotan Cohen wrote: On Thu, Jun 13, 2013 at 4:20 PM, Robert Kern robert.k...@gmail.com wrote: Yes. Do you think there is a problem with doing so? I'm pretty sure that Requests will use either urllib or urllib2, depending on what is available on the server. I would like to

Re: Convert SOAP response (ArrayOfInt) to Python list

2013-07-05 Thread Burak Arslan
Hi, FYI, There's a soap-specific python.org list: s...@python.org On 07/04/13 20:57, robert.wink...@bioprocess.org wrote: Thanks to the OSA library, which works for SOAP requests with Python 3.x, I can now use SOAP services at http://www.chemspider.com. The results structure is

Re: Python - remote object protocols and security

2013-07-15 Thread Burak Arslan
Hi, On 07/15/13 13:30, Chris Angelico wrote: On Mon, Jul 15, 2013 at 10:26 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Basically, I need to transfer numbers (int). Possibly dictionaries like {string: int} in order to structure things a little bit. I strongly recommend JSON,

Re: Python - remote object protocols and security

2013-07-15 Thread Burak Arslan
On 07/15/13 13:51, Chris Angelico wrote: So the only bit you still need is: How do you transmit this across the network? Since it's now all just bytes, that's easy enough to do, eg with TCP. But that depends on the rest of your system, and is a quite separate question - and quite probably one

Re: Python - remote object protocols and security

2013-07-15 Thread Burak Arslan
On 07/15/13 16:53, Chris Angelico wrote: I haven't looked into the details, but there was one among a list of exploits that was being discussed a few months ago; it involved XML schemas, I think, and quite a few generic XML parsers could be tricked into fetching arbitrary documents. Whether

[ANN] PyUBL

2014-11-25 Thread Burak Arslan
All, We've gone through the grunt work of researching and integrating XMLDSIG, XAdES and UBL schemas and its various extensions and dependencies and wrote a bunch of scripts that map these documents to python objects. UBL stands for Universal Business Language. It's an OASIS standard that

Re: [ANN] PyUBL

2014-11-27 Thread Burak Arslan
On 11/26/14 08:53, dieter wrote: Burak Arslan burak.ars...@arskom.com.tr writes: We've gone through the grunt work of researching and integrating XMLDSIG, XAdES and UBL schemas and its various extensions and dependencies and wrote a bunch of scripts that map these documents to python objects

Re: how to generate a wsdl file for a web service in python

2014-12-18 Thread Burak Arslan
On 12/18/14 11:58, brice DORA wrote: hi to all I am new to python and as part of my project I would like to create a SOAP web service. for now I've developed my python file with all the methods of my future web service, but my problem now is how to generate the wsdl file ... my concern may

Re: how to generate a wsdl file for a web service in python

2014-12-21 Thread Burak Arslan
On 12/19/14 12:45, brice DORA wrote: i have already my python file which contains all methods of my web service. so do you give a example or tell me how i can do it... No, all you need is there in that example. You need to decorate your functions using Spyne's @rpc, denote input/output types

Re: Own network protocol

2014-12-29 Thread Burak Arslan
Hi, On 12/29/14 10:18, pfranke...@gmail.com wrote: Hello Steven! Thank you for your answer! RPyC indeed looks great! I need to deep dive into the API reference, but I think its capabilities will suffice to do what I want. Do you know whether non-python related clients can work with this

[issue13284] email.utils.formatdate function does not handle timezones correctly.

2011-10-28 Thread Burak Arslan
New submission from Burak Arslan burak.ars...@arskom.com.tr: There's an issue with email.utils.formatdate function, illustrated here: https://gist.github.com/1321994 for reference i'm on Europe/Istanbul timezone, which is +03:00 because of DST at the time of this writing. I'm on stable

[issue13284] email.utils.formatdate function does not handle timezones correctly.

2011-10-28 Thread Burak Arslan
Burak Arslan burak.ars...@arskom.com.tr added the comment: turns out timetuple was not passing timezone information. the correct way of converting a datetime.datetime object to a correct rfc-2822 compliant date string seems to be: email.utils.formatdate(time.mktime(a.utctimetuple()) + 1e-6

Re: New to Programming - XML Processing

2015-04-01 Thread Burak Arslan
On 04/01/15 06:27, catperson wrote: I am new to programming, though not new to computers. I'm looking to teach myself Python 3 and am working my way through a tutorial. At the point I'm at in the tutorial I am tasked with parsing out an XML file created with a Garmin Forerunner and am just

Re: How to handle attachments passed via Postfix

2015-10-13 Thread Burak Arslan
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 10/13/15 00:52, Anthony Papillion wrote: >> Check out the email.parser module, or the convenience function >> > email.message_from_string - you should be able to get at the >> > different parts (including attachments) from there. >> > > Many

Re: XML Binding

2015-09-03 Thread Burak Arslan
Hello, On 09/03/15 19:54, Palpandi wrote: > Hi All, > > Is there any module available in python standard library for XML binding? If > not, any other suggestions. lxml is the right xml library to use. You can use lxml's objectify or Spyne. Here are some examples:

Re: New JSON encoding method proposal for custom objects

2015-12-01 Thread Burak Arslan
hey, On 11/30/15 14:35, cescu...@gmail.com wrote: > > Hello everyone and thank you for your interest! > > The Peter's code is very similar to what I think the default JSON encoder > should be. > > The advantage of the method that I propose is that you should not care > anymore about which