[web2py] Re: please help us test new web site
Can you change a little you CSS? blockquote { ... padding: 3px 15px 10px 20px; ... } with this it will look better than now. On 11 окт, 22:35, Bruno Rocha rochacbr...@gmail.com wrote: I am working on a new idea suggested by Massimo and considering every suggestion that people gave here. Today we gonna have a new logo! Now we need help to migrate all html to markmin, after that we can start translations. 2010/10/11 ma...@rockiger.com rocki...@googlemail.com 1+ It is established and is pleasing. On Oct 11, 5:20 am, Richard richar...@gmail.com wrote: forgot to include my point - so how about remove the WP thing and just keep the stylish web2py text. On Oct 11, 2:16 pm, Richard richar...@gmail.com wrote: I like the Django and Symfony logos: http://upload.wikimedia.org/wikipedia/commons/7/75/Django_logo.svghtt... Straightforward. Richard On Oct 11, 8:24 am, mdipierro mdipie...@cs.depaul.edu wrote: I was working on it live. Sorry. Fixed now. On Oct 10, 4:22 pm, Rowdy da...@fielden.com.au wrote: mdipierro wrote: New web2py layout: http://web2py.com Thanks Bruno and Martin New demo_admin: http://web2py.com/demo_admin Massimo Looks good, clean, professional, consistent. Some comments: 1. The black icons for the links on the lower right (User Groups, Twitter ...) stand out from the rest of page. They look a bit dark and angular compared to the slightly softer look of the rest of the site. Maybe buttons like the ones on the Download page would look better. 2. The download link was returning a 404 error this morning (about 10 minutes ago), but just seems to have fixed itself. Rowdy -- http://rochacbruno.com.br
[web2py] [python2.4] need patch for 1.79.2
Massimo, here non-2.4 constructions in tools.py:2838 ( get_query method ). Here my fast fix: def get_query(self, field, op, value, refsearch=False): try: if refsearch: format = self.get_format(field) if op == 'equals': if not refsearch: return field == value else: return lambda row: row[field.name][format] == value elif op == 'not equal': if not refsearch: return field != value else: return lambda row: row[field.name][format] != value elif op == 'greater than': if not refsearch: return field value else: return lambda row: row[field.name][format] value elif op == 'less than': if not refsearch: return field value else: return lambda row: row[field.name][format] value elif op == 'starts with': if not refsearch: return field.like(value+'%') else: return lambda row: str(row[field.name] [format]).startswith(value) elif op == 'ends with': if not refsearch: return field.like('%'+value) else: return lambda row: str(row[field.name] [format]).endswith(value) elif op == 'contains': if not refsearch: return field.like('%'+value+'%') else: return lambda row: value in row[field.name] [format] except: return None I can't find better solution...
[web2py] web2py bugs
Massimo, can you apply this patches ? Why my posts was completely ignored ? patches: http://groups.google.com/group/web2py/browse_thread/thread/6ceafe4a7f0beb6c http://groups.google.com/group/web2py/browse_thread/thread/bd3dde6a13608549 What's wrong for them ?
[web2py] [BUG] solution for form.custom.widget and custom widget
For complex widgets there is bug. During form validation _traverse method doesn't change form.custom.widget. But field.widget(field, value) return correct representation. This is lead to wrong field widget output for custom form and custom widget when error occurred. Solution is simple: --- sqlhtml.py +++ sqlhtml.py @@ -909,8 +909,10 @@ if hasattr(field, 'widget') and field.widget\ and fieldname in request_vars: row_id = '%s_%s%s' % (self.table,fieldname,SQLFORM.ID_ROW_SUFFIX) -self.field_parent[row_id].components = [field.widget(field, value)] +widget = field.widget(field, value) +self.field_parent[row_id].components = [ widget ] self.field_parent[row_id]._traverse(False) +self.custom.widget[ fieldname ] = widget ## also update widget for custom form creation return ret if record_id and record_id != self.record_id:
[web2py] [patch] search pattern for '{{extend}}'
Pattern in gluon/myregex.py must be compiled with MULTILINE option: regex_extend = re.compile(\ '^\s*(?Pall\{\{\s*extend\s+[\'](?Pname[^\']+)[\']\s*\}\})', re.MULTILINE ) When {{extend ''}} not in first line of file it doesn't be shown in admin page.
[web2py] [python2.4] small patch for 1.76.5
Easy and small fixes for newest web2py. This is generated with 'git format-patch -1' command. From: ont.rif ont@gmail.com Date: Fri, 9 Apr 2010 20:28:03 +0700 Subject: [PATCH] (f) fix code to work with python 2.4 --- tools.py | 12 ++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tools.py b/tools.py index cc6f656..9b3d197 100644 --- a/tools.py +++ b/tools.py @@ -2525,7 +2525,10 @@ urllib2.install_opener(urllib2.build_opener(urllib2.HTTPCookieProcessor())) def fetch(url, data=None, headers={}, cookie=Cookie.SimpleCookie(), user_agent='Mozilla/5.0'): -data = data if data is None else urllib.urlencode(data) + +if data is not None: +data = urllib.urlencode(data) + if user_agent: headers['User-agent'] = user_agent headers['Cookie'] = ' '.join(['%s=%s;'%(c.key,c.value) for c in cookie.values()]) try: @@ -2534,7 +2537,12 @@ def fetch(url, data=None, headers={}, req = urllib2.Request(url, data, headers) html = urllib2.urlopen(req).read() else: -method = urlfetch.GET if data is None else urlfetch.POST + +if data is None: +method = urlfetch.GET +else: +method = urlfetch.POST + while url is not None: response = urlfetch.fetch(url=url, payload=data, method=method, headers=headers, -- 1.5.5.6 -- To unsubscribe, reply using remove me as the subject.
[web2py] Re: JqGrid Plugin
:-) same bug as for http://groups.google.ru/group/web2py/browse_thread/thread/96877110aa87f20c/83536771ac515f8c#83536771ac515f8c I have found intresting feature for JqGrid 3.5.2 http://blogs.teamb.com/craigstuntz/2010/02/08/38548/ May be it is useful to add this option to this plugin ? On 28 мар, 21:35, mdipierro mdipie...@cs.depaul.edu wrote: :-) On Mar 28, 4:04 am, parroit andrea.par...@ebansoftware.net wrote: Thank you. Yes, I can merge with it. I look at the existing jqgrid plugin files. I'll add the search feature and the parameters for columns width, names etc... I'll add a post here when I'll done with the work. Bye Andrea On 28 Mar, 03:18, mdipierro mdipie...@cs.depaul.edu wrote: I looked at it and you did excellent work. I have one issue and one proposal. The issue is that plugin_editable_jqgrid.py exposes classes and methods that do not start with plugin_editable_jqgrid and that is a problem because can potentially conflict with other plugins. The proposal is that we merge it with the existing jqgrid plugin. Can you take a first crack at merging them? I will be happy to do any required cleanup work and post it. Massimo On 27 Mar, 19:38, mdipierro mdipie...@cs.depaul.edu wrote: I will look at it asap. Thank you! Massimo On 27 Mar, 11:51, parroit andrea.par...@ebansoftware.net wrote: Hi. I've developed a plugin to use JqGrid with inline editing and json updates. I've published some help at this page:http://app.ebansoftware.net, but I think it be more useful to publish it also onhttp://www.web2py.com/plugins. What is the correct procedure to publish the plugin on that site? Thanks Andrea -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py] XSS injection in jqgrid plugin
May be it is not so dangerous... It is really beauty plugin, but I easy can add any html code in table (include script/script tag). http://web2py.com/plugins/default/jqgrid -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
[web2py:38055] Re: web2py and python 2.4
I have found a few more problems. Below content of a patch which can fix them. Patched code sucessfully runs on CentOS 5.4 (web2py 1.74.4). I drop out fixes for sql.py diff -ru --exclude '*.pyc' --exclude sql.py ./2.5/main.py ./2.4/ main.py --- ./2.5/main.py 2009-12-16 12:42:47.0 +0700 +++ ./2.4/main.py 2009-12-30 16:19:47.0 +0700 @@ -29,7 +29,7 @@ import random #import sneaky import rewrite -import functools +#import functools import string from restricted import RestrictedError from http import HTTP, redirect @@ -212,7 +212,8 @@ response.status = str(status).split(' ',1)[0] response.headers = dict(headers) -return functools.partial(response.write, escape=False) +return lambda *args, **kargs: response.write( escape=False, *args, **kargs ) +#return functools.partial(response.write, escape=False) def middleware_aux(request, response, *middleware_apps): Только в ./2.5: python24.patch Только в ./2.5: .sql.py.swp diff -ru --exclude '*.pyc' --exclude sql.py ./2.5/tools.py ./2.4/ tools.py --- ./2.5/tools.py 2009-12-23 02:48:17.0 +0700 +++ ./2.4/tools.py 2009-12-30 16:46:48.0 +0700 @@ -17,7 +17,7 @@ import base64 import cPickle import datetime -import email +from email import * import sys import os import re @@ -53,7 +53,7 @@ Works with SMTP and Google App Engine. -class Attachment(email.MIMEBase.MIMEBase): +class Attachment(MIMEBase.MIMEBase): Email attachment @@ -121,12 +121,12 @@ filename = filename.encode(encoding) if content_type == None: content_type = contenttype(filename) -email.MIMEBase.MIMEBase.__init__(self, *content_type.split ('/', 1)) +MIMEBase.MIMEBase.__init__(self, *content_type.split('/', 1)) self.set_payload(payload) self['Content-Disposition'] = 'attachment; filename=%s' % filename if content_id != None: self['Content-Id'] = '%s' % content_id.encode (encoding) -email.Encoders.encode_base64(self) +Encoders.encode_base64(self) def __init__(self, server=None, sender=None, login=None, tls=True): @@ -251,7 +251,7 @@ to = list(to) if len(to) == 0: raise Exception('Target receiver address not specified') -payload = email.MIMEMultipart.MIMEMultipart('related') +payload = MIMEMultipart.MIMEMultipart('related') payload['To'] = ', '.join(to).decode(encoding).encode ('utf-8') if reply_to != None: payload['Reply-To'] = reply_to.decode(encoding).encode ('utf-8') @@ -274,19 +274,19 @@ text = message html = None if text != None or html != None: -attachment = email.MIMEMultipart.MIMEMultipart ('alternative') +attachment = MIMEMultipart.MIMEMultipart('alternative') if text != None: if isinstance(text, str): text = text.decode(encoding).encode('utf-8') else: text = text.read().decode(encoding).encode ('utf-8') -attachment.attach(email.MIMEText.MIMEText(text)) +attachment.attach(MIMEText.MIMEText(text)) if html != None: if isinstance(html, str): html = html.decode(encoding).encode('utf-8') else: html = html.read().decode(encoding).encode ('utf-8') -attachment.attach(email.MIMEText.MIMEText(html, 'html')) +attachment.attach(MIMEText.MIMEText(html, 'html')) payload.attach(attachment) if attachments == None: pass On 30 дек, 04:26, mdipierro mdipie...@cs.depaul.edu wrote: Ouch! You are right. That code slipped in. I have just removed them in trunk (hg only, I am having problem posting on launchpad) and will repost 1.74.5 later this week. Massimo On Dec 29, 2:59 pm, Richard richar...@gmail.com wrote: I think there are a few examples in sql.py, such as lines 2928 and 2939 On Dec 30, 1:53 am, mdipierro mdipie...@cs.depaul.edu wrote: web2py libraries does not use (a if Condition else b) but example apps and plugins may. It works with2.4but you need some extra modules. There is an AlterEgo entry about this. On Dec 29, 7:48 am, Richard richar...@gmail.com wrote: did you manage to get web2py running with2.4? I noticed web2py uses (a if Condition else b), which was syntax introduced in 2.5. Richard On Nov 22, 11:12 am, pepe_eloy pepe.e...@gmail.com wrote: Returning to the theme about installhashlibin python2.4,, excuse my ignorance, but is it possible to install these packages in a shared environment? (assuming I do not have root access) Regards Jose Eloy Torres -- You received this message because you are subscribed to the Google
[web2py:34329] Re: Mail.send
Did you try to change to: mail.settings.login = thade...:mypass (without @ and server name) This is because line in gluon/tools.py (username, password) = self.settings.login.split(':') On Oct 31, 2:25 am, Thadeus Burgess thade...@thadeusb.com wrote: Would anybody know why I can send mail using SMTP through Evolution, yet when using the exact same credentials for web2py Mail(), email does not get sent? It is quite odd actually though. mail.settings.server = mail.example.com:25 mail.settings.sender = thade...@example.com mail.settings.login = thade...@example.com:mypass Now when I use a mail.send() to other email accounts within the @example.comdomain, the emails get delivered, however when I use mail.send() to outside of the @example.com domain, liek @gmail and @yahoo, the emails never get delievered. Using evolution to send, the emails get sent, using squirrelmail interface works as well. Using gmail's smtp will not deliver emails outside of the @ example.com domain either. This was working until I switched the DNS A record of the root domain to a slicehost IP, yet leaving the mail subdomain A record pointing to the mail server. example.com. A 123.456.789.012 mail.example.com A 321.321.355.012 With evolution working correctly, I am baffled. Has anybody else ever run into this? Or have an idea on what is going on here. -Thadeus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:33925] Re: powered by web2py?
Oh, yes, I take this sign from early version of web2py. Now we use mini-banner. On Oct 27, 12:20 pm, mdipierro mdipie...@cs.depaul.edu wrote: Nice and useful! Thank you for the acknowledgment. I would prefer if you just mention web2py and not my name (and this applies to everybody else too). It is important to stress there is a large community behind the product. On Oct 27, 12:06 am, ont.rif ont@gmail.com wrote: http://help4me.ru This is our first attempt. we use this things: * FastCGI + apache * PostgreSQL * git for version control and deployment On Oct 26, 9:46 am, mdipierro mdipie...@cs.depaul.edu wrote: www.appliedstacks.comisdead. This means I lost a way to keep track of web2py sites. So I made something trivial for now: http://web2py.com/poweredby I am sure I missing many sites that were reported. Could you help me update the list by posting on this thread? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:33798] Re: powered by web2py?
http://help4me.ru This is our first attempt. we use this things: * FastCGI + apache * PostgreSQL * git for version control and deployment On Oct 26, 9:46 am, mdipierro mdipie...@cs.depaul.edu wrote: www.appliedstacks.comis dead. This means I lost a way to keep track of web2py sites. So I made something trivial for now: http://web2py.com/poweredby I am sure I missing many sites that were reported. Could you help me update the list by posting on this thread? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:26400] Possible bug in sql.py [python 2.4]
Here is exception when my script insert unicode data: [part of ticket message]- File /var/www/vhosts/help4me.ru/subdomains/web2py/httpdocs/gluon/ sql.py, line 1480, in insert self._db._execute(query) File /var/www/vhosts/help4me.ru/subdomains/web2py/httpdocs/gluon/ sql.py, line 734, in lambda self._execute = lambda *a, **b: self._cursor.execute(*a, **b) File /usr/lib/python2.4/site-packages/MySQLdb/cursors.py, line 146, in execute query = query.encode(charset) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 55: ordinal not in range(128) --- [part of controller]-- login = uБла email = request.vars.email passw = request.vars.passw code = uuid.uuid4() tusers.insert( login = login, email = email, passw = passw, state = code ) --- I try to convert login to unicode string and also try to pass non unicode string. Error in two cases be the same. MySQL database and table use UTF8 encoding. And insertion unicode data from phpMyAdmin works very well. Now i try to execute code below: this code fail db._cursor.execute( INSERT INTO users (login, passw, email, state) VALUES ( 'бла', 'bla', 'bla', 'bla' ) ) this code sucess db._cursor.execute( uINSERT INTO users (login, passw, email, state) VALUES ( 'бла', 'bla', 'bla', 'bla' ) ) Now possible solution: Convert query to unicode python string before passing it to db._execute ( ... ) Example: --[gluon.sql]- def insert(self, **fields): query = self._insert(**fields) query = query.decode( 'utf8' ) self._db['_lastsql'] = query self._db._execute(query) --- Also need convertions in select, executesql. Python MySQLdb need unicode string for successfull execution of query = query.encode(charset) But web2py by default set charset to 'uft8' when creates new database object and does not pass to MySQLdb module unicode strings. Sorry for my english. P.S. after insertion a couple of lines query = query.decode ( 'utf8' ) into sql.py all works now ! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:26406] Re: Possible bug in sql.py [python 2.4]
This patch seems to work with PostreSQL too. Here is output of diff command. % diff -u sql.py sql_new.py --- sql.py 2009-07-13 20:20:37.0 +0800 +++ sql_new.py 2009-07-13 20:20:30.0 +0800 @@ -1017,6 +1017,7 @@ self._connection.rollback() def executesql(self, query): +query = query.decode( 'utf8' ) self['_lastsql'] = query self._execute(query) try: @@ -1476,6 +1477,7 @@ def insert(self, **fields): query = self._insert(**fields) +query = query.decode( 'utf8' ) self._db['_lastsql'] = query self._db._execute(query) if self._db._dbname == 'sqlite': @@ -2136,6 +2138,7 @@ def response(query): +query = query.decode( 'utf8' ) self._db['_lastsql'] = query self._db._execute(query) return self._db._cursor.fetchall() @@ -2173,6 +2176,7 @@ def delete(self): query = self._delete() self.delete_uploaded_files() +query = query.decode( 'utf8' ) self._db['_lastsql'] = query self._db._execute(query) try: @@ -2204,6 +2208,7 @@ def update(self, **update_fields): query = self._update(**update_fields) self.delete_uploaded_files(update_fields) +query = query.decode( 'utf8' ) self._db['_lastsql'] = query self._db._execute(query) try: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:/] Re: Possible bug in sql.py [python 2.4]
But i can't find way to insert utf-8 data into MysSQL database! For example: tusers = db.define_table( 'users', Field( 'login', 'string', required = True, notnull = True, unique = True ), Field( 'passw', 'string', required = True, notnull = True ), Field( 'email', 'string', length = 100, required = True, notnull = True, unique = True ), Field( 'state', 'string', length = 100 )) But nothing of this is work : 1) tusers.insert( login = Русский, email = English, passw = English, state = English ) 2) tusers.insert( login = uРусский, email = English, passw = English, state = English ) 1) and 2) does not work, because it produce exception of this type: [exception]--- File /usr/lib/python2.4/site-packages/MySQLdb/cursors.py, line 146, in execute query = query.encode(charset) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 55: ordinal not in range(128) --- query is a simple python non unicode string. I.e. type( query ) == type 'str' But only type( query ) == type 'unicode' can be encoded with non ASCII chars. Try this: s = фыва s.encode( 'utf8' ) Traceback (most recent call last): File stdin, line 1, in module UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 0: ordinal not in range(128) What the best way to insert unicode data from request.vars to database ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:26423] Re: Possible bug in sql.py [python 2.4]
In short: MySQLdb execute expect type 'unicode' string but web2py pass type 'str' object to it. May be this is a problem ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:26477] Re: Possible bug in sql.py [python 2.4]
No, use_unicode affect only output of MySQLdb. I found problem: On my hosting with CentOS 5.2 file /usr/lib/python2.4/site-packages/MySQLdb/cursors.py contains this code: - from types import ListType, TupleType from sys import exc_info del self.messages[:] db = self._get_db() charset = db.character_set_name() query = query.encode(charset) if args is not None: query = query % db.literal(args) try: r = self._query(query) MySQLdb.__version__ '1.2.1' And on my home computer: from types import ListType, TupleType from sys import exc_info del self.messages[:] db = self._get_db() charset = db.character_set_name() if isinstance(query, unicode): query = query.encode(charset) if args is not None: query = query % db.literal(args) try: r = self._query(query) MySQLdb.__version__ '1.2.2' So, bug exist in MySQLdb. And on CentOS 5.2 it seems that i must handle it by my own :( Thank for you help, massimo ! On 14 июл, 00:39, mdipierro mdipie...@cs.depaul.edu wrote: perhaps it should be MySQLdb.connect(use_unicode=False) Strange I never had a problem with this? On Jul 13, 10:04 am, ont.rif ont@gmail.com wrote: In short: MySQLdb execute expect type 'unicode' string but web2py pass type 'str' object to it. May be this is a problem ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---
[web2py:26011] gluon/validators.py for python 2.4
Some portion of code in gluon/validators.py use python 2.5 specific code. And so, registration of users in web2py does not work on hosting with CentOS 5.3 Solution: change this: domain = value.partition('@')[2] to this: ## absent in python 2.4 domain = value.partition('@')[2] domain = value.split( '@' ) if len( domain ) 2: domain = '' else: domain = domain[ 1 ] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups web2py Web Framework group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~--~~~~--~~--~--~---