Re: text representation of HTML

2006-09-21 Thread Ksenia Marasanova
t; > I guess stripogram would be more pythonic : > http://sourceforge.net/project/showfiles.php?group_id=1083 > > Regards, > > Laurent > > Diez B. Roggisch wrote: > > > Ksenia Marasanova wrote: > > > >> Hi, > >> > >> I am looking for a li

text representation of HTML

2006-07-19 Thread Ksenia Marasanova
Hi, I am looking for a library that will give me very simple text representation of HTML. For example TitleThis is a test will be transformed to: Title This is a test i want to send plain text alternative of html email, and would prefer to do it automatically from HTML source. Any hints? Tha

install python2.4 on FreeBSD and keep using python2.3

2005-11-17 Thread Ksenia Marasanova
Hi, I have python2.3, installed from port /lang/python long time ago. The current version is 2.4, but I'd rather have two python versions, instead of upgrading. Is there maybe a way to somehow link installed python to /lang/python2.3 port, and then upgrade ports and install /lang/python as a new (

Re: Postgres PL/Python

2005-09-18 Thread Ksenia Marasanova
Thanks to all, especially to Stuart, for very informative answers. It's clear to me now that there is no need in my case to use functions / stored procedures (yes, with typical MVC app I meant a webapp on the same server with database, administered by the same persons). However it can be a useful

Re: How does f=open('mytext.txt', 'w+') work?

2005-09-18 Thread Ksenia Marasanova
18 Sep 2005 09:11:51 -0700, Alex <[EMAIL PROTECTED]>: > Rossum's tutorial on Python states: it's "Van Rossum's" :) "van" in a part of the last name, you can't just cut it away in Dutch :) -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Postgres PL/Python

2005-09-15 Thread Ksenia Marasanova
Hi, I wonder if anyone on this list is using Python as Postgres procedural language. I can't find a place for it i my mind. How would a typical MVC web application benefit from it (besides performance)? I understand from the docs that Postgres 7.4 has PL/PythonU - unlimited functionality. It sou

Re: using metaclass __call__ to replace class instance

2005-09-09 Thread Ksenia Marasanova
2005/9/9, Peter Otten <[EMAIL PROTECTED]>: > Ksenia Marasanova wrote: > > > class BasemethodMeta(type): > > def__new__(cls,class_name,bases,new_attrs): > > cls=type.__new__(cls,class_name,bases,new_attrs) > > new_attrs['__me

Re: using metaclass __call__ to replace class instance

2005-09-09 Thread Ksenia Marasanova
2005/9/9, Ksenia Marasanova <[EMAIL PROTECTED]>: > class BasemethodMeta(type): > def __new__(cls, class_name, bases, new_attrs): > cls = type.__new__(cls, class_name, bases, new_attrs) > new_attrs['__metaclass__'].cls = cls > return

using metaclass __call__ to replace class instance

2005-09-09 Thread Ksenia Marasanova
Hi all, I am creating some library, and want use "declarative" style in the subclasses as much as possible, while the actual use will be more method-like. Just to give an impression, the library would be something like this: class Baseclass(object): # lot's of code goes here... class Baseme

Re: Django and SQLObject. Why not working together?

2005-09-08 Thread Ksenia Marasanova
2005/9/8, Sokolov Yura <[EMAIL PROTECTED]>: > Django Model is wonderfull. But SQLObject more flexible (and powerfull, > as i think, and has already more db interfaces). > But Django Model is tied with Django, and using Django with another OO > mapping is not comfortable. > Why do not working togeth

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> return [(node.id, node.ord_number) for node in self.get_path()] I meant: > return [(node.ord_number, node.id) for node in self.get_path()] -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
2005/8/10, Peter Otten <[EMAIL PROTECTED]>: > I think you cannot get away with your first rule, but have to operate on the > full path instead. Otherwise the position of inner nodes would sometimes be > determined by their url and sometimes by their ord_number *during* *the* > *same* *sort*. Rrr.

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
Example of the wrong sort: class Node: def __init__(self, name, url, order, pid, id): self.name = name self.url = url self.order = order self.pid = pid self.id = id def __repr__(self): return '%s [order: %s]' % (self.url, self.order) def

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> class Node: > def __init__(self, name, url, order, pid, id): > self.name = name > self.url = url > self.order = order > self.pid = pid > self.id = id > def __repr__(self): > return self

sorting question

2005-08-10 Thread Ksenia Marasanova
Hi, I have a list that contains nodes from a tree. Each node is a class instance, but I'll use dictionary here to simplify the example. So the list looks like this: [ {'id': 1, 'name': 'Parent node', 'ord_number': 1, 'parent_id': 0, 'url': '/parentnode/'}, {'id': 2, 'name': 'My node', 'ord_number'

Re: Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Ksenia Marasanova
12 Jun 2005 08:12:14 -0700, Michele Simionato <[EMAIL PROTECTED]>: > What about doing it yourself? > > >>> import inspect, os > >>> print "%s" % inspect.getsource(os.makedirs) That's easy, thanks! I guess I'll submit a patch for Epydoc with the functionality I've mentioned :) -- Ksenia -- htt

Code documentation tool similar to what Ruby (on Rails?) uses

2005-06-12 Thread Ksenia Marasanova
Hi, I wonder if there is a tool for generation Python API documentation that can include source code into HTML output. Example: http://api.rubyonrails.com/ I really like the possibility to click on "show source" link and read the source of the method! AFAIK it is not possible with Epydoc and Pydo

Re: web based file manager in python

2005-04-25 Thread Ksenia Marasanova
> Ksenia - I recently came across this python web-based FM: > > http://snakelets.sourceforge.net/filemgr/index.html > > It is by Irmen De Jong, the author of Snakelets. > Looks good! Thank you very much :) -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

web based file manager in python

2005-04-25 Thread Ksenia Marasanova
Hi, I didn't suceed in finding any kind of standard web based file manager, written in Python. There are quite a lot for PHP (the nicest I found is phpXplorer: http://www.phpxplorer.org) , but I'd rather use Python. I don't mind installing one of the millions webframeworks for this (well, except f

Re: templating system

2005-04-13 Thread Ksenia Marasanova
On 4/13/05, James Carroll <[EMAIL PROTECTED]> wrote: > I've had fantastic results with SimpleTAL > http://www.owlfish.com/software/simpleTAL/ > > It uses the Zope Page Templates style markups (which are wysiwyg in > dreamweaver) and then pulls contents from python functions and > 'contexts' ve

Re: templating system

2005-04-13 Thread Ksenia Marasanova
> In the interests of full disclosure, I'm the author of EmPy. > Cool :) > All I meant by that note was that EmPy was not primarily designed for > blazing speed; that is, it could easily be made much more efficient in a > lot of ways. I've never had a need to do so, so it's always been low > pri

Re: templating system

2005-04-11 Thread Ksenia Marasanova
> > > http://www.reportlab.org/preppy.html Looks very close to what I was looking for :) Thanks! -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: templating system

2005-04-11 Thread Ksenia Marasanova
> In EmPy, your template would look something like this:: > > > @[for record in records]@ > @record.title > @[end for]@ > > > Batch expanding the template would look like something as simple as > (substituting in your example):: > > ... >

templating system

2005-04-10 Thread Ksenia Marasanova
Hi, I am looking for fast, simple templating system that will allow me to do the following: - embed Python code (or some templating code) in the template - generate text output (not only XML/HTML) I don't need a framework (already have it), but just simple templating. The syntax I had in mind is

Re: How to create an object instance from a string??

2005-03-19 Thread Ksenia Marasanova
On 19 Mar 2005 14:16:42 -0800, Tian <[EMAIL PROTECTED]> wrote: > How can I create an instance of an object from a string? > > For example, I have a class Dog: > class Dog: > def bark(self): > print "Arf!!!" > > I have a string: > classname = "Dog" > > How can I create a instance of Dog fro

Re: getting data with proper encoding to the finish

2005-03-16 Thread Ksenia Marasanova
John, Serge, thanks for your help! utf-16le encoding didn't help. I had however to solve it yesterday, so I used csv module to create CSV file and then import it in Excel. Excel still had troubles with accented characters, but this is another story: it seems that Office 2004 Excel (for Mac, but I

Re: getting data with proper encoding to the finish

2005-03-14 Thread Ksenia Marasanova
> > There is some amount of data in a database (PG) that must be inserted > > into Excel sheet and emailed. Nothing special, everything works. > > Except that non-ascii characters are not displayed properly. > > The data is stored as XML into a text field. > > This sentence doesn't make much sense

getting data with proper encoding to the finish

2005-03-14 Thread Ksenia Marasanova
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed. Nothing special, everything works. Except that non-ascii characters are not displayed properly. The data

Re: modifiable config files in compiled code?

2005-03-10 Thread Ksenia Marasanova
You can also do: settings = {} execfile('/path/to/file/myconfig.conf', settings) myconfig.conf is a Python file. After this all variables from myconfig.conf are stored in settings dictionary. -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: Making a calendar

2005-02-26 Thread Ksenia Marasanova
This is close to what you want: http://freespace.virgin.net/hamish.sanderson/htmlcalendar.html You'll also need HTMLTemplate http://freespace.virgin.net/hamish.sanderson/htmltemplate.html -- http://mail.python.org/mailman/listinfo/python-list

extracting HTML fragments and counting words

2005-02-18 Thread Ksenia Marasanova
Hi, I want to show preview of several HTML formatted newsitems on one page, preserving markup (and images) intact, but showing not more thatn X first _readable_ words of every page. Is anyone aware of some Python library that makes programming this easy? I already started to program it with Beaut

Re: escape string for command line

2005-01-08 Thread Ksenia Marasanova
> > > > I was wondering, is there a general way to escape the string entered > > by the user, to prevent code injection into command line? > > Take a look at the "string-escape" encoding: > > >>> evil = "'; rm -rf /;" > >>> command = "echo '%s'" > >>> print command % evil.encode('string-escape')

escape string for command line

2005-01-07 Thread Ksenia Marasanova
Hi, I have a simple ecard creation script on a website, where user can add text to a graphic. I use ImageMagick for it: # template_file => path to image template file # new_file => path to generated file # text => user input command = '''convert %s -font OfficinaSanITC-BookOS -pointsize 12 -fill