3 ### Form-urlencoding functions
5 ### (c) 2006 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the Python interface to mLib.
12 ### mLib/Python is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or
15 ### (at your option) any later version.
17 ### mLib/Python is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU General Public License for more details.
22 ### You should have received a copy of the GNU General Public License
23 ### along with mLib/Python; if not, write to the Free Software Foundation,
24 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30 def __cinit__(me, *hunoz, **hukairz):
33 def __init__(me, strictp = False, laxp = False, semip = False):
43 def encode(me, char *name, char *value):
44 url_enc(&me.ctx, &me.d, name, value)
48 return PyString_FromStringAndSize(me.d.buf, me.d.len)
51 return _tobool(me.ctx.f & URLF_STRICT)
54 me.ctx.f = me.ctx.f | URLF_STRICT
56 me.ctx.f = me.ctx.f & ~URLF_STRICT
59 return _tobool(me.ctx.f & URLF_LAX)
62 me.ctx.f = me.ctx.f | URLF_LAX
64 me.ctx.f = me.ctx.f & ~URLF_LAX
67 return _tobool(me.ctx.f & URLF_SEMI)
70 me.ctx.f = me.ctx.f | URLF_SEMI
72 me.ctx.f = me.ctx.f & ~URLF_SEMI
80 def __cinit__(me, *hunoz, **hukairz):
82 url_initdec(&me.ctx, me.p)
83 def __init__(me, char *string, semip = False):
89 me.p = xstrdup(string)
102 anyp = url_dec(&me.ctx, &n, &v)
104 nn = PyString_FromStringAndSize(n.buf, n.len)
105 vv = PyString_FromStringAndSize(v.buf, v.len)
113 return _tobool(me.ctx.f & URLF_SEMI)
114 def __set__(me, val):
116 me.ctx.f = me.ctx.f | URLF_SEMI
118 me.ctx.f = me.ctx.f & ~URLF_SEMI
122 ###----- That's all, folks --------------------------------------------------