[issue6858] This is a python file, apply syntax highlighting

2010-08-01 Thread gert cuykens
gert cuykens gert.cuyk...@gmail.com added the comment: On Sun, Aug 1, 2010 at 4:55 PM, Tal Einat rep...@bugs.python.org wrote: Tal Einat talei...@gmail.com added the comment: I'm +1 on adding such an option to the menu, if only to be able to highlight files including only Python code which

[issue6858] This is a python file, apply syntax highlighting

2010-08-01 Thread gert cuykens
gert cuykens gert.cuyk...@gmail.com added the comment: On Mon, Aug 2, 2010 at 12:06 AM, Terry J. Reedy rep...@bugs.python.org wrote: Terry J. Reedy tjre...@udel.edu added the comment: There are, perhaps 3 main issues with new features; 1. What is the specific proposal? In particular

[issue6858] This is a python file, apply syntax highlighting

2009-09-07 Thread gert cuykens
New submission from gert cuykens gert.cuyk...@gmail.com: http://groups.google.be/group/comp.lang.python/browse_thread/thread/252fa1ccd0251977# Menu option please, so I can highlight .wsgi .txt .xml files with python code in it, does not matter if non python code gets wrongly highlighted too

def obj()

2007-02-08 Thread Gert Cuykens
def obj(): return {'data':'hello', 'add':add(v)} def add(v): data=data+v if __name__ == '__main__': test=obj() test.add('world') print test.data I don't know why but i have one of does none class c programing style moods again. I was wondering if the

Re: def obj()

2007-02-08 Thread Gert Cuykens
On 2/8/07, Leif K-Brooks [EMAIL PROTECTED] wrote: def obj(): result = {'data': 'hello'} result['add'] = adder(result) return result def adder(obj): def add(value): obj['data'] += value return add if __name__ == '__main__': test = obj()

Re: def obj()

2007-02-08 Thread Gert Cuykens
#include stdio.h function hello(){ struct obj = { char *data = 'hello'} obj.add = obj_add(obj); return obj; } function obj_add(obj){ function add(value){ obj.data += value; return obj; } } main(){ test = hello(); test.add('world');

Re: instancemethod

2007-01-26 Thread Gert Cuykens
class Obj(object): pass toto = tutu = tata = titi = Obj() What's an instance name ? -- http://mail.python.org/mailman/listinfo/python-list i would say __object__.__name__[3] == toto And if your obj is a argument like something(Obj()) i would say __object__.__name__[0] ==

Re: instancemethod

2007-01-23 Thread Gert Cuykens
import MySQLdb class Db(object): def __enter__(self): pass def __init__(self,server,user,password,database): self._db=MySQLdb.connect(server , user , password , database) self._db.autocommit(True) self.cursor=self._db.cursor() def execute(self,cmd):

Re: instancemethod

2007-01-22 Thread Gert Cuykens
Reading all of the above this is the most simple i can come too. import MySQLdb class Db: def __init__(self,server,user,password,database): self._db=MySQLdb.connect(server , user , password , database) self._db.autocommit(True) self.cursor=self._db.cursor() def

instancemethod

2007-01-21 Thread Gert Cuykens
import MySQLdb class Db: _db=-1 _cursor=-1 @classmethod def __init__(self,server,user,password,database): self._db=MySQLdb.connect(server , user , password , database) self._cursor=self._db.cursor() @classmethod def excecute(self,cmd):

Re: instancemethod

2007-01-21 Thread Gert Cuykens
On 21 Jan 2007 14:35:19 -0800, Nanjundi [EMAIL PROTECTED] wrote: if __name__ == '__main__': gert=Db('localhost','root','**','gert') gert.excecute('select * from person') for x in range(0,gert.rowcount): print gert.fetchone() gert.close() [EMAIL

Re: instancemethod

2007-01-21 Thread Gert Cuykens
On 1/22/07, Gabriel Genellina [EMAIL PROTECTED] wrote: Gert Cuykens [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] class Db: _db=-1 _cursor=-1 @classmethod def __init__(self,server,user,password,database): self._db=MySQLdb.connect(server

Re: instancemethod

2007-01-21 Thread Gert Cuykens
On 1/22/07, Gert Cuykens [EMAIL PROTECTED] wrote: On 1/22/07, Gabriel Genellina [EMAIL PROTECTED] wrote: Gert Cuykens [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] class Db: _db=-1 _cursor=-1 @classmethod def __init__(self,server,user

Re: instancemethod

2007-01-21 Thread Gert Cuykens
import MySQLdb class Db: _db=-1 _cursor=-1 rowcount=-1 def __init__(self,server,user,password,database): self._db=MySQLdb.connect(server , user , password , database) self._cursor=self._db.cursor() def excecute(self,cmd): self._cursor.execute(cmd)

Re: instancemethod

2007-01-21 Thread Gert Cuykens
never mind i think i need some sleep lol i did the exact opposite this time .rowcount() - .rowcount -- http://mail.python.org/mailman/listinfo/python-list

Re: whats wrong with my reg expression ?

2007-01-16 Thread Gert Cuykens
thx it works now -- http://mail.python.org/mailman/listinfo/python-list

Re: for v in l:

2007-01-16 Thread Gert Cuykens
ok thx this was just what i was looking for http://docs.python.org/tut/node7.html#SECTION00760 -- http://mail.python.org/mailman/listinfo/python-list

whats wrong with my reg expression ?

2007-01-15 Thread Gert Cuykens
rex2=re.compile('^(?Pvalue[^]*)$',re.M) File /usr/lib/python2.5/re.py, line 180, in compile return _compile(pattern, flags) File /usr/lib/python2.5/re.py, line 233, in _compile raise error, v # invalid expression sre_constants.error: unexpected end of regular expression ? --

Re: whats wrong with my reg expression ?

2007-01-15 Thread Gert Cuykens
thx PS i also cant figure out what is wrong here ? rex=re.compile('^(?Pvalue[^]*)$',re.M) for v in l: v=rex.match(v).group('value') v=v.replace('','') return(l) v=rex.match(v).group('value') AttributeError: 'NoneType' object has no attribute

for v in l:

2007-01-15 Thread Gert Cuykens
is there a other way then this to loop trough a list and change the values i=-1 for v in l: i=i+1 l[i]=v+x something like for v in l: l[v]=l[v]+x -- http://mail.python.org/mailman/listinfo/python-list

Re: attribute decorators

2007-01-05 Thread Gert Cuykens
sorry for repost i just found out the news group comp.lang.python is the same as python-list@python.org :) On 5 Jan 2007 20:34:54 -0800, gert [EMAIL PROTECTED] wrote: Would it not be nice if you could assign decorators to attributes too ? for example class C: @staticattribute

Re: def index(self):

2006-12-22 Thread Gert Cuykens
Ok thx i think i understand it now class C: ... @staticmethod ... def fn(): ... return 'whohoo' ... C.fn() 'whohoo' -- http://mail.python.org/mailman/listinfo/python-list

attribute decorators

2006-12-22 Thread Gert Cuykens
would it not be nice if you could assign decorators to attributes too ? for example class C: @staticattribute data='hello' or class C: @privateattribute data='hello' -- http://mail.python.org/mailman/listinfo/python-list

Re: def index(self):

2006-12-21 Thread Gert Cuykens
On 21 Dec 2006 09:44:48 GMT, Duncan Booth [EMAIL PROTECTED] wrote: George Sakkis [EMAIL PROTECTED] wrote: @expr def fn(...): ... is exactly equivalent to: def fn(...): ... fn = (expr)(fn) ok i did my homework reading about decorators http://www.python.org/doc/2.4.4/whatsnew/node6.html

Re: def index(self):

2006-12-20 Thread Gert Cuykens
class HelloWorld(object): @cherrypy.exposed def index(self): return Hello World do i have to write @cherrypy.exposed before every def or just once for all the def's ? and why not write something like @index.exposed ? in other words i have no idea what @ actually does i

Http server

2006-12-19 Thread Gert Cuykens
so far this works code import cherrypy import os.path class Http: def index(self): f = open(os.path.join(os.path.dirname(__file__), '../htm/index.htm')) xml = f.read() f.close() return xml index.exposed = True cherrypy.tree.mount(Http()) if __name__ ==

Re: Http server

2006-12-19 Thread Gert Cuykens
The cute secretary's name is cherrypy.tools.staticdir. Check out her resume at http://www.cherrypy.org/wiki/StaticContent I think i am in love :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Http server

2006-12-19 Thread Gert Cuykens
The cute secretary's name is cherrypy.tools.staticdir. Check out her resume at http://www.cherrypy.org/wiki/StaticContent I think i am in love :) Cant believe this just works out code import os.path import cherrypy pwd = os.path.dirname(os.path.abspath(__file__)) class Http:

Re: Http server

2006-12-19 Thread Gert Cuykens
Does anybody know how to redirect a post request ? i have a js file that does a post request to a /php/action.php file and i would like for the secretary to just do the action method instead that is defined in her python Http class book, so i can run both php and python without changing the

def index(self):

2006-12-18 Thread Gert Cuykens
Is there a difference between code class HelloWorld: def index(self): index.exposed = True return Hello world! /code and code class HelloWorld: def index(self): self.exposed = True return Hello world! /code -- http://mail.python.org/mailman/listinfo/python-list

Re: def index(self):

2006-12-18 Thread Gert Cuykens
FWIW, the first version raises an exception (unless of course the name 'index' is already bound in the enclosing scope). And the second won't probably work as expected with CherryPy. code class HelloWorld: def index(self): return Hello world! index.exposed = True #DOOH! /code i

import

2006-12-17 Thread Gert Cuykens
I would like to lauch a server from outside the side package directory how do i specify a path with import #/home/gert/Desktop/www/db/py/start-server.py import cherrypy class HelloWorld: def index(self): return #external htm file Hello world! index.exposed = True if __name__ == '__main__':