Handling more zodb databases with zeo

2005-06-24 Thread Almad
Hello, 

sorry for bothering with same question again. However, month ago, I have
tried to handle more zodb databases with zeo as described here:
http://mail.python.org/pipermail/python-list/2005-May/279915.html

Since then, I don't have had a time to play with it and now I tried again.
However, even after reading
http://www.zope.org/Wikis/ZODB/FrontPage/guide/index.html few times, I have
no idea how to handle this (as anywhere I read, client only connect to port
and do not select filestorage). Only possibility I see is to run more zeo
instances, which is not neccessary as I have read. 

Thank You for help, 
-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Hello, 

I'm currently starting with Python as a language for writing websites. I
must say that I'm overwhelmed by the number of choices I have (mod_python
with publisher, Vampire, mps, Spyce), cgi, fcgi, Webware, Zope,
Plone, ...). 

Isn't there any article in style "this suite use this style of programming
and is good for this type of applications"? 

I've tried mod_python.publisher and Spyce so far (and looked on few others,
as mps, Vampire and Cheerypy). I'm currently giving Spyce the biggest
chance...however, I'm not very satisfied with "in-line" coding (PSP-style)
as I do not want to program this way and I think it must have some
performance impact...but session.auto, request and response modules are big
help. 
I'm satisfied with concept of mps, however It's fine that author hate
writing HTML, but I want to; or better, I want to use Cheetah Templates - i
think they are better for bigger sites (then homepage) as the one I want to
write. 

Well...what exactly I'm looking for? 

1) No module importing problem. In ideal case, specify directory, so I can
just import my_module, my_another_module...but that has to be "sandboxed"
for each apache virtual host. I would like to avoid interference between
sites I'm hosting. 

2) Pooling. I want to have "pool" for data, which are shared between
sites/request, f. e. database connection. However, for some sites I would
like to have "kernel" module, which will be loaded in RAM, so sites must
not grab data from database (f. e. number of users online). However, this
could be solved by running system daemon on server...but it's not the ideal
solution, IMHO. 

3) I'm not looking for framework so much complex as Zope or Plone is. My
site is specific with some original ideas, which are not reusable on other
sites, so I want to write it "from scratch". Additionally, I like to knew
code of the sites on web - f. e. using Cheetah don't bother me (it's not
directly on web), but using Phorum or phpBB yes. 

I'm not interested in calling of pages (page.py/function or page.py?args), I
will use mod_rewrite anyway. 

Is there anything what will satisfy my requirements, or I must write it? :)
Or I'm looking on this problem from bad shape and re-inventing wheel?

Thanks for advises (and sorry for long post for those who don't like it), 

-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Dan Perl wrote:
> Have you looked at these links?
> http://www.python.org/pycon/papers/framework/web.html
> Dan

Thank You, I haven't found this one...exactly what I was looking for. 

-- 

Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: The stars are constantly shining, but often we do not see them until the
dark hours. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python on WWW - beginners question: what to choose?

2005-02-07 Thread Almad
Jeff  Reavis wrote:

> Spyce has support for pooling

True, but as covered by this message:
http://sourceforge.net/mailarchive/forum.php?thread_id=6381534&forum_id=10008,
for my purpose, Spyce must run as proxy server. However, when running as
proxy, it seems that I can't (really) run virtual hosts (no "sandboxing" as
specified by me in (1)). This is described by my (unreplied) message:
http://sourceforge.net/mailarchive/forum.php?thread_id=6460778&forum_id=10008
 
> -jjr

-- 

Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: The stars are constantly shining, but often we do not see them until the
dark hours. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-07 Thread Almad
M.E.Farmer wrote:

> Paul Rubin wrote:
> To emulate a table you use the div and span tag.

Sorry, but I don't think that this is the way you have to create web pages. 
I think the most important think is to have web pages "semantic valid". That
means, do not use table for formatting whole page, but when you have table
data, you have to use tables. Don't you? 
-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


ZoDB's capabilities

2005-02-28 Thread Almad
Hello, 

I'm going to write a custom CMS. I'd like to use some odbms, as code is then
much more cleaner...however, i'm a little bit scared about capabilities of
ZoDB, when compared with f. e. Firebird. 
How much instances is Zodb able to handle? Under "handle" I mean "in real
time", not "theoretically". I'd like to use it for dynamic portal with
about 2000 - 3000 UIP / day. 

And, how is it with stability and crash recovery? I can't find some more
sources about zodb, when there are some other sources then those on Zope,
please tell me. Or, please tell me if you knew some better odbms engine ^_^

Thanks, 
-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZoDB's capabilities

2005-03-01 Thread Almad
Larry Bates wrote:

> There is a VERY large website that uses Zope/ZODB that takes up to
> 9000 hits per second when it gets busy.  ZODB is very fast and
> holds up well under load.

If it's true, I'm glad. Other side of think is, on what hardware is this
site running :o)

 
> You should probably look at Plone.  It is CMS already built on
> top of Zope.  Might safe you a LOT of work.

I've looked on Plone, I don't want it. My CMS will be somehow very specific,
and I prefer to learn from my programming.


> Larry Bates

-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


IndexedCatalog and ZEO

2005-03-06 Thread Almad
Hello, 

I'm trying to use IndexedCatalog
[http://www.async.com.br/projects/IndexedCatalog/] in my CherryPy
[http://www.cherrypy.org] application. 
As Zodb support access just from one Python thread, I must either use just
one CherryPy thread (slow), or use ZEO. However, if I understand it good,
when I use 
from ZEO import ClientStorage

then ZEO is internally using FileStorage, so no IndexedCatalog is used. 

Anyone knews, how to use IndexedCatalog with ZEO, or do I have to "patch"
ZEO for myself (or run this one thread)? 

Thanks, 
-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IndexedCatalog and ZEO

2005-03-07 Thread Almad
Leif K-Brooks wrote:
> from IndexedCatalog.Shelf import Shelf
> shelf = Shelf(('localhost', 1234), [Class1, Class2])

Thanks, that is what I was searching for. 

-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IndexedCatalog and ZEO

2005-03-07 Thread Almad
Leif K-Brooks wrote:

> from IndexedCatalog.Shelf import Shelf
> shelf = Shelf(('localhost', 1234), [Class1, Class2])

Is it also possible to connect via socket instead of port? I've tried to
pass '/tmp/zeosocket' instead of ('localhost', 1234), but it isn't
successfull. Is is any way to do that? 

Thank You, 
-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Multiple calls to logging.config.fileConfig

2006-10-05 Thread Almad
Hi,

our applications can have plugins as subpackages and I'd like to allow
them to use their own logger as well as it's configuration. I thought
that best way will be their own configuration file passed to
fileConfig.

However, I run into problems...

1) It seems that I cannot refer to something from previously loaded
files, i.e. I'd like application config file to specify formatters and
handlers and plugins only referring them.

2) I'm not sure about "appending" loggers; if I specify
[loggers]
keys: web

and then
[loggers]
keys: syncml

Will web not be overwritten?

3) Finally, I run into "root" problem. In second call, if I specify
root logger again:

[loggers]
keys: root,web

(...)

[logger_web]
level: WARNING
qualname: xxx.web
handlers: console

I'll get

Traceback (most recent call last):
  File "/usr/lib/python2.4/logging/config.py", line 143, in fileConfig
llist.remove("root")


If I'll set only web as logger, I'll get standard NoSectionFound
exception.

Any idea how to fix this? It seems that I have to write custom parser
merging all files and config logging directly from code, but I'd like
to assure that it's the standard way...

Regards,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Python crushing on kinterbasdb connect @ FreeBSD

2006-11-04 Thread Almad
Hi,

I uploaded my application on our production server running FreeBSD and
I found it crashing at startup.

Problem is in connecting to my Firebird database:
kinterbasdb.connect(with either good or wrong arguments) is resolving
in:

python in free(): error: junk pointer, too high to make sense
Abort trap (core dumped)

I installed kinterbasdb manually while I need 3.2 version for DBClass
and latest in ports is 3.1; could this be the problem? (rest of system
is from ports)

Thank You for any advice,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with XML-RPC not mounted in /

2006-11-06 Thread Almad
Hi,

I'm trying to build XML-RPC service, both server and client library.

My server is CherryPy with XML-RPC filter. I have here method
registration_ip. When it's in, say http://ws.rpgplanet.nerv/,
everything is OK, but when I move it in http://ws.rpgplanet.nerv/main/,
this behaviour occur:

 srv = ServerProxy('http://ws.rpgplanet.nerv/main/')
 print srv.register_ip("guest")

raises 404, as according to log, library is trying to access /main/
instead of /main/register_ip

 srv = ServerProxy('http://ws.rpgplanet.nerv/')
 print srv.main.register_ip("guest")

raises 500, as client is correctly hitting /main/register_ip, but NOT
sending "guest" argument.

I'm probably missing something obvious, so where should problem be? Is
it not possible for XML-RPC to live not in / ?

Thank You for advices,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with XML-RPC not mounted in /

2006-11-06 Thread Almad
Just FYI, this is bug in CP filter machinery, xmlrpc filter do not
apply recursively so do not dispatch reuqest.

Quick fix is to xmlrpcfilter.on not only on /ws, but also on /ws/main

Regards,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Inconsistency in dictionary behaviour: dict(dict) not calling __setitem__

2006-12-12 Thread Almad
Hello,

I discovered this behaviour in dictionary which I find confusing. In
SneakyLang, I've tried to extend dictionary so it visits another class
after something is added:

class RegisterMap(dict):
def __setitem__(self, k, v):
dict.__setitem__(self, k,v)
self[k].visit_register_map(self)


However, when constructing dictionary with dictionary in constructor
like d = RegisterMap({'k':'v'}), __setitem__ is not called, so
workaround is needed:

class RegisterMap(dict):
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
for k in self:
self.__after_add(k)

def __after_add(self, k):
self[k].visit_register_map(self)

def __setitem__(self, k, v):
dict.__setitem__(self, k,v)
self.__after_add(k)


What is the reason for this behavior? Am I doing something wrong and
better approach is needed? Or should this be considered as minor bug in
Python? (tried this only in 2.4 so far)

Thank You,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Inconsistency in dictionary behaviour: dict(dict) not calling __setitem__

2006-12-14 Thread Almad
Thanks to everybody for replies, I'm now satisfied ^_^

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


sha-2 and sha-512 bindings

2005-05-04 Thread Almad
Hi, 

is there any python bindings for sha-2 or sha-512? 

Pycrypto seems to have only sha-1 bindings and I can't see any other package
on net...

Thanks, 
-- 
Lukas "Almad" Linhart

[:: http://www.almad.net/ ::]
[:: Humans are too complicated to be described with words. ::]
[:: PGP/GNUPg key: http://www.almad.net/download/pubkey.asc ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


handling more databases with ZEO

2005-05-06 Thread Almad
Hello, 

I'm using zodb with zeo and I want to connect to more databases from my
application. On server side, it's no problem, I just set up second
filestorage: 


path /var/www/databases/zodb/almad-net.fs


path /var/www/databases/zodb/azilla.fs


However, I dunno how to connect from app. Currently, I'm using

serverData = {
'shelf' : Shelf(('localhost', 11000), [Cat1, Cat2])
}

I dunno where to pass any argument to let ZEO knew where I'm connecting to.
Please let me knew any resource where this is described...

Thanks, 
-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


xsd2gui

2005-06-08 Thread Almad
Hello, 

is there any way how to generate GUI form from given XML Schema? 
I mean, any lib which can do it? I think it's usable for "gui editing" of
XML File.

Google give me only completed standalone programs or non-python solutions. 

Thanks, 
-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


ZCatalog for standalone Zodb?

2005-06-14 Thread Almad
Hello, 

is ZCatalog available for standalone zodb? As far as I read tutorial, the
relation to zope is obvious. 

I knew there is IndexedCatalog, but its not developed any more...and without
indexing, oodbms are unusable for cms, imo. 

Thank You, 
-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ZCatalog for standalone Zodb?

2005-06-14 Thread Almad

Thomas Guettler wrote:
> Hi,

Hi, 
 
> There was someone who said that he has ported ZCatalog to "standalone"
> ZODB. Look in the archive of zodb-dev.

Thanks, I'll try. 

> AFAIK IndexedCatalog is still in 
> development. Maybe the mailing list is calm, but I think it is not
> orphaned.

As developers on #async told me, they are not using IC for their product any
more. So, They will fix reported bugs, but not adding new features. 
 
>  HTH,
>    Thomas

Thanks, 
 

-- 
Lukas "Almad" Linhart
[:: http://www.almad.net/ ::]
-- 
http://mail.python.org/mailman/listinfo/python-list


Regression testing with Python

2007-06-05 Thread Almad
Hi,

I'd like to ask how do You resolve "resources" issue when writing
regression tests in Python. When doing functional tests, I have some
resources that might not be available (like database, HTTP server,
Selenium testing proxy) and I'd like then to skip test gracefully (not
either failing nor green status).

Is there a simple way to do this?

Or, how do You build Your Selenium testsuites and integrate them into
main suite?

Thank You,

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


PIL thumbnails unreasonably large

2006-05-10 Thread Almad
Hello,

I wonder how do I create reasonable thumbnails from JPEG with PIL.
My code:

logging.debug('Downloading image %s' % id)
uri = ''.join([config['photo']['masterpath'], '?p=',
str(id)])
uf = urlopen(uri).read()
f = tmpfile()
f.write(uf)
f.seek(0)
logging.debug('Resizing image %s' % id)
img = Image.open(f)
prev = img.copy()
img.thumbnail((180,180))
if prev.size[0] > 640 or prev.size[1] > 640:
prev.thumbnail((640,640))
# save resized to temporary files
f.seek(0)
img.save(f, "JPEG", quality=50)
fp = tmpfile()
prev.save(fp, "JPEG", quality=200)

Well, works fine, but img size is about 0,5 MB (!), but strangely, prev
one is around 200 kb.

How do I change this? I tried to play with various quality settings,
but with no effect. img thumbnail is supposed to be < 10 kb...

Thank You, 

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL thumbnails unreasonably large

2006-05-10 Thread Almad
Forgot to add: I'm using PIL 1.1.5 with Python 2.4, expected on both
Gentoo Linux and Windows XP.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL thumbnails unreasonably large

2006-05-11 Thread Almad
Thank You! That helped.

Somehow obvious when you pointed out, but...*phew*.

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


FTP filename escaping

2006-05-11 Thread Almad
Hello,

I feel ashamed, but my google-fu betrayed me again.

How do I escape filenames when using ftplib? I'd like to download it
and upload on ftp again...
toDown = self.ftpMaster.nlst()
for fileDown in toDown:
f = tmpfile()
# download
self.ftpMaster.retrbinary(''.join(['RETR ', fileDown]),
f.write)
f.seek(0)
self.ftpMirror.storbinary(''.join(["STOR ", fileDown]), f,
1024)
f.close()

Problem is when fileDown contains special characters / spaces and so
on. I hoped for some ftplib.quote(), urllib.quote() or quote_plus() is
not functional either.

Is there such a function in stdlib or do I have to read through
specification and write it? 

Thank You, 

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP filename escaping

2006-05-11 Thread Almad
OK, after some investigation...problem is in non-latin characters in
filenames on ftp.

Yes, users should be killed for this, but I would like to handle it
somehow...

I can't figure out how it's handled by protocol, ftplib seems to just
strip those characters...

Thank You, 

Almad

-- 
http://mail.python.org/mailman/listinfo/python-list


Python and TSAPI / TAPI

2006-03-29 Thread Almad
Hello, 

I'm now trying to get our PBX working with our Python application, but I have 
no success so far. I have searched for both tsapi and tapi python wrappers, 
but with no luck, I only found ruby (incompleted) one for tsapi.

No problem, I decided to write my own, using pythonwin and ctypes. However, I 
have troubles parsing responses with struct.unpack(), getting no relevant 
data for pythons equivalent of ruby's eventBuf.unpack('LSSLA21A21A21A21').

So I'm asking: is there any python-tsapi library, open-source or commercial 
(tapi one is also welcomed)? Is there anybody experienced with python-tsapi 
communication? I'd like to wrap C tsapi calls in python (as I do not want to 
write C wrapper, it's a long time since I wrote something in C), is there 
anybody who want to help me? 

Regards, 

Lukas "Almad" Linhart
http://www.almad.net/
-- 
http://mail.python.org/mailman/listinfo/python-list