[web2py] Re: RSS is an error! What to do?

2014-11-17 Thread damufo
Hi:
This patch broke my rss.
When update web2py 2.9.5 to 2.9.11 the RSS produces an encoding error.


Ticket ID 
>
> 192.168.0.109.2014-11-18.08-43-24.a4e11dac-b0ab-49b8-83b7-105ea1ba5ad2
>  'ascii' codec can't encode 
> character u'\xf3' in position 23: ordinal not in range(128) Version  
> web2py™ Version 2.9.11-stable+timestamp.2014.09.15.23.35.11  Python Python 
> 2.7.3: /usr/bin/python (prefix: /usr)  Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 224, in restricted
> exec ccode in environment
>   File "/home/www-data/web2py/applications/mp/modules/plugins/feed/feed.rss", 
> line 12, in 
> from gluon.serializers import rss
>   File "/home/www-data/web2py/gluon/serializers.py", line 172, in rss
> description=safestr(feed,'description'),
>   File "/home/www-data/web2py/gluon/serializers.py", line 167, in safestr
> return str(obj[key]).encode('utf-8', 'replace') if key in obj else default
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 
> 23: ordinal not in range(128)
>
> Error snapshot [image: help] 
> 
>  
>
> ('ascii' codec can't encode 
> character u'\xf3' in position 23: ordinal not in range(128)) 
>

when restore web2py/gluon/serializers.py to version 2.9.5 work fine

My python version is 2.7.3
will relate to this? 
https://groups.google.com/forum/#!topic/web2py/8ZwVMKS69Sg

My feed.rss page is:
dd=dict(title="my feed",
link=u"feed.example.com",
description="carácter acentuado".decode('utf-8'),
entries=[
  dict(title="my feed",
  link=u"http://feed.example.com";,
  description="my first feed")
])
from gluon.serializers import rss   
response.write(rss(dd), escape=False)
response.headers['Content-Type']='application/rss+xml'


El miércoles, 10 de septiembre de 2014 15:27:07 UTC+2, Massimo Di Pierro 
escribió:
>
> Sorry for the trouble here:
>
> I pushed this to trunk:
> def rss(feed):
> if not 'entries' in feed and 'items' in feed:
> feed['entries'] = feed['items']
> def safestr(obj, key, default=''):
> return str(obj[key]).encode('utf-8', 'replace') if key in obj else 
> default
>
> now = datetime.datetime.now()
> rss = rss2.RSS2(title=safestr(feed,'title'),
> link=safestr(feed,'link'),
> description=safestr(feed,'description'),
> lastBuildDate=feed.get('created_on', now),
> items=[rss2.RSSItem(
>title=safestr(entry,'title','(notitle)'),
>link=safestr(entry,'link'),
>description=safestr(entry,'description'),
>pubDate=entry.get('created_on', now)
>) for entry in feed.get('entries', [])])
> return rss.to_xml(encoding='utf-8')
>
> please let me know if this fixes it. If not, please send me more details 
> about the feed you are trying to read.
>
>  
>
On Tuesday, 9 September 2014 00:45:25 UTC-5, Капылов Данил wrote:
>>
>> Does not work. :-)
>>
>> Error ticket for "welcome"Ticket ID
>>
>> 127.0.0.1.2014-09-09.11-33-31.6f78e65a-5d28-410e-9111-55ded191b520
>>  'NoneType' object has no attribute 
>> 'encode'Версияweb2py™Version 2.9.9-stable+timestamp.2014.09.08.13.16.54
>> PythonPython 2.7.6: C:\Python27\python.exe (prefix: C:\Python27)Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>>
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\restricted.py",
>>  line 221, in restricted
>> exec ccode in environment
>>   File 
>> "C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\applications\welcome\views\generic.rss",
>>  line 10, in 
>> from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
>>   File 
>> "C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\serializers.py",
>>  line 168, in rss
>> link=str((feed.get('link') or '').encode('utf-8', 'replace')),
>> AttributeError: 'NoneType' object has no attribute 'encode'
>>
>> Error snapshot [image: help] 
>> 
>>
>> ('NoneType' object has no attribute 
>> 'encode')
>>
>> inspect attributes
>> Frames
>>
>>- 
>>
>>*File 
>>
>> C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\gluon\restricted.py
>>  
>>in restricted at line 221* код аргументы переменные
>>- 
>>
>>*File 
>>
>> C:\Users\�\Documents\MEGAsync\Web2pyProject\Ad\web2py\applications\welcome\views\generic.rss
>>  
>>in  at line 10* код аргументы переменные
>>- 
>>
>>*File 
>>
>> C

Re: [web2py] Re: registration settings not working

2014-11-17 Thread Vid Ogris
mail was not send to verify a new user. I found out that is because I was
not using auth form but SQLFORM.factory. After I changed mail is now send

2014-11-18 5:44 GMT+01:00 Massimo Di Pierro :

> what is not working?
>
>
> On Monday, 10 November 2014 04:21:31 UTC-6, Yebach wrote:
>>
>> Hello
>>
>> In my db.py i have the following settings
>>
>> auth.settings.registration_requires_verification = True
>> auth.settings.registration_requires_approval = True/False  - it is
>> always Fasle - user can login even if I set to True??
>> auth.settings.reset_password_requires_verification = True
>>
>>
>> mail=Mail()
>> auth.settings.mailer=mail
>> mail.settings.server=':25'
>> mail.settings.sender='sen...@algit.si'
>> mail.settings.login=':pass'
>> mail.settings.tls = False
>>
>> auth.messages.verify_email = 'Click on the link http://
>> '+request.env.http_host+URL(r=request,c='default'
>> ,f='user',args=['verify_email'])+'/%(key)s to verify your email'
>> auth.settings.reset_password_requires_verification = True
>> auth.messages.reset_password = 'Click on the link http://'+\
>>   request.env.http_host+\
>>   URL(r=request,c='default',f='user',args=['reset_password'])+\
>>   '/%(key)s to reset your password'
>>
>>
>> none of this seems to be working.
>> Mail server is ok because
>> mail.send('vi...@net.si',  'Message subject',  'Plain
>> text body of the message') is working
>>
>>
>> Any suggestions?
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/afim2XigV3o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Lep pozdrav

Vid Ogris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Current controller function for Facebook buttons

2014-11-17 Thread Gael Princivalle
Hello all.

I would like to add Like and Share buttons to my app.
It seems really simple with this Facebook instructions:
https://developers.facebook.com/docs/plugins/like-button

I've had these buttons at the end of my layout,.
I need to build the url to pass to Facebook.
data-href="http://www.mydomain.com//{{=my current controller function and 
my current vars and args)}}"

How can I do it ?

Regards

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] read an excel file stored in session using xlrd

2014-11-17 Thread T.R.Rajkumar
form_upload = SQLFORM.factory(Field('your_excel_file', 'upload',uploadfolder
='helloworld/uploads'))
if form_upload.process().accepted:
session.your_excel_file = form.vars.your_excel_file

def import_from_excel():
workbook = xlrd.open_workbook(session.your_excel_file)


When import_from_excel() is called gives rise to the below error.
How to access excel file stored in session? 

File "F:/trr/web2py/web2py/applications/helloworld/controllers/cms_meas.py" 
, 
line 255, in import_from_excel
workbook = xlrd.open_workbook(session.your_excel_file)
  File "D:\Python\lib\site-packages\xlrd\__init__.py", line 366, in 
open_workbook
formatting_info=formatting_info,
  File "D:\Python\lib\site-packages\xlrd\__init__.py", line 725, in __init__
f = open(filename, open_mode)
TypeError: coercing to Unicode: need string or buffer, NoneType found




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: second page to be accessed only from first page

2014-11-17 Thread T.R.Rajkumar
I am able to visit the second page directly without visiting the first page 
if I have only the request.function. If I add the session var condition 
then it restricts.

On Saturday, November 15, 2014 3:28:15 PM UTC+5:30, T.R.Rajkumar wrote:
>
> In book chapter 3 overview the following is given to restrict access to 
> second page. 
>
> if not request.function=='first' and not session.visitor_name:
> redirect(URL('first'))
>
> But if I print request.function it says 'second'.
> How to restrict access to second page only from first page?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: a proposal for form improvement

2014-11-17 Thread Massimo Di Pierro
In my todo list but no great progress yet.

On Friday, 14 November 2014 05:58:10 UTC-6, Ramos wrote:
>
> Just checking the status of Jform.
> Any news on it?
>
> Regards
> António
>
> 2014-09-10 2:02 GMT+01:00 Massimo Di Pierro :
>
>> I agree. I have not implemented but I was planning to add this feature. 
>>
>> On Tuesday, 9 September 2014 03:44:30 UTC-5, Leonel Câmara wrote:
>>>
>>> This is the corresponding JS one optimized for bootstrap 3:

 jform.widgets['text'] = function(field) { return 
 jform.tag('textarea',{'name':field.name,'class':'form-
 control'})(field.value); }

>>>
>>> Massimo that looks good, however in SQLFORM I can change the textwidget 
>>> in a very specific way - I can change it for a single field on a single 
>>> table on a single controller, changing widgets in jform like this wouldn't 
>>> work because you would change the text widget for all jforms being rendered 
>>> in that webpage. 
>>>
>>> Maybe you want to change the widget for just that one form and leave the 
>>> others unchanged. Sometimes, you do want to change your textwidgets 
>>> application wide but sometimes you don't. So things get a little more 
>>> complicated.  
>>>
>>> There needs to be some way to define context for jform where you can 
>>> customize just one single form. Basically JForm would need to have a 
>>> dictionary of table or even form specific widgets where you could do 
>>> something like.
>>>
>>> jform.widgets.forms[myformid]['text'] = function(field) { return 
>>> jform.tag('textarea',{'name':field.name,'class':'form-
>>> control'})(field.value); }
>>> jform.widgets.tables[tablename]['text'] = function(field) { return 
>>> jform.tag('textarea',{'name':field.name,'class':'form-
>>> control'})(field.value); }
>>>
>>> So things do start to get messy. This solution, of course, isn't ideal 
>>> if you are building a single page app as this context you're creating 
>>> doesn't get automatically cleaned every call like it happens on the server 
>>> side with SQLFORM so then you start to get strange interactions and bugs. 
>>> Hence we have to figure out a smarter way to do it where the context is 
>>> really available for just that one form and it goes away with it.
>>>
>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: is_list_of validator question

2014-11-17 Thread Massimo Di Pierro
Problem is that IS_LIST_OF experts to validate a list. Instead you are 
passing "" (not a list) and None (also not a list).
I agree that it is odd that interprets '' as [] and None as [None].
They should either be interpreted as [''] and [None] or both as an empty 
list.

Your proposed fix makes sense and I would take a patch.




On Wednesday, 12 November 2014 02:21:04 UTC-6, Manuele wrote:
>
> Does it makes sense or do you agree with this behaviour? 
>
> In [5]: IS_LIST_OF(IS_NOT_EMPTY())('') 
> Out[5]: ([], None) 
>
> In [6]: IS_LIST_OF(IS_NOT_EMPTY())(None) 
> Out[6]: ([None], 'Enter a value') 
>
> In [7]: IS_NOT_EMPTY()('') 
> Out[7]: ('', 'Enter a value') 
>
> I mean... I expected that the first result would be: 
> ([''], 'Enter a value') 
>
> Thank you very mutch 
>
> Manuele 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How do you issue a command to the operating system in web2py?

2014-11-17 Thread Cliff Kachinske
Why do you want to do that?

On Friday, November 14, 2014 4:01:25 PM UTC-5, BitHui wrote:
>
> I'm trying to run a shell command in Linux from web2py?  Is that possible 
> and how would you accomplish that?  Thanks in advance.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Query of two dates sql server

2014-11-17 Thread Cliff Kachinske
The online manual explains it here:

http://web2py.com/books/default/chapter/29/07/forms-and-validators#Date-and-time-validators

If I recall correctly, it may also be necessary to make an entry in your 
language dictionary. But try it first without such an entry.

On Monday, November 17, 2014 5:49:57 PM UTC-5, José Eloy wrote:
>
> Hi!
>
> I'm having troubles in making a query with 2 dates in SQL Server 2005.
>
> First, my table definition:
>
> db2.define_table('tabla_datos',
> Field('na', requires=IS_NOT_EMPTY()), 
> Field('fecha', 'datetime', requires=[IS_NOT_EMPTY(), 
> IS_DATETIME(format=T("%d/%m/%Y %H:%M:%S"), error_message='Debe ser 
> DD-MM- HH:MM:SS!')]),
> Field('ta', db2.tipos_de_asunto),
> Field('unidad',  requires=IS_NOT_EMPTY()),
> Field('operador'),
> Field('carta', requires=IS_NOT_EMPTY()),
> Field('importe', 'decimal(15,2)', requires=IS_NOT_EMPTY()),
> Field('observaciones') 
> )
>
> In my controller I receive from a form (via ajax) two dates for searching 
> in the database:
>
> def busca_consulta():
>
> num_asunto = request.post_vars.input_na   
> desde = request.post_vars.input_desde   # User write a date using 
> the Web2py widget. Format: %d/%m/%Y (time is not necessary)
> hasta = request.post_vars.input_al   # User write a date 
> using the Web2py widget. Format: %d/%m%Y (time is not necessary)
>
> rows= db2(((db2.tabla_datos.fecha>=desde) & 
> (db2.tabla_datos.fecha<=hasta)) & (db2.tabla_datos.na
> ==num_asunto)).select()
>  
> but I get error, Is it necessary to convert the variables "desde" and 
> "hasta" to datetime? How can I convert them?
>
> I've checked the SQL Server datetime format, the datetime is saved in the 
> records using the following format: %Y-%d-%m %H:%M:%S. I live in Mexico, 
> the format we use is: %d/%m/%Y %H:%M:%S
>
> My english is not very good, I hope you can understand me.
>
> Regards.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: py and pyc files

2014-11-17 Thread Massimo Di Pierro
yes. Strange you get a pyc file error. Perhaps you have a compiled app?

On Tuesday, 11 November 2014 15:49:21 UTC-6, John Davis wrote:
>
> Hello
>
> If I get an error in the ticket exception output which shows an error at 
> line x in a .pyc file, can I assume that the corresponding .py file on line 
> x is the error?
>
> John
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-17 Thread Massimo Di Pierro
There is a  

scripts/setup-web2py-centos7.sh 

which is more recent

On Tuesday, 11 November 2014 05:29:34 UTC-6, lesssugar wrote:
>
> Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking 
> for deployment script, as I'm no expert.
>
> Apache and MySQL is in place, but I'm looking for relatively painless way 
> to automatically install web2py, configure mod_wsgi etc.
>
> Any help?
>
> *EDIT:*
>
> This looks OK, I guess: 
> http://web2py.googlecode.com/hg/scripts/setup-web2py-fedora.sh
> However, I would like to change the path from */opt/web-apps/ *to 
> */var/www/*. Don't think this could cause problems.
>
> What do you think about the linked script? Seems quite outdated (it was 
> posted on web2pyslices in 2010 if I'm correct).
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: play audio file from controller

2014-11-17 Thread Massimo Di Pierro
there is a function db.mytable.myfield.retrieve(row.myfield)


On Monday, 10 November 2014 10:51:53 UTC-6, LoveWeb2py wrote:
>
> Here is the code in the link:
> db.define_table('music', Field('name',required=True), 
> Field('filename','upload',required=True), auth.signature) " > 
> applications/audio/models/db_audio.py echo " response.menu = 
> [('Home',0,URL('index'))] # allows to browser, search, and upload new music 
> (if logged in) def index(): # tell web2py that links to music files are to 
> be # represented as HTML5 audio embedded players from 
> gluon.contrib.autolinks import expand_one db.music.filename.represent = 
> lambda v,r: \ XML(expand_one(URL('download',args=v),{})) return dict(grid = 
> SQLFORM.grid(db.music)) # perform login/logout/registration/etc. def 
> user(): return dict(form=auth()) # allow streaming of all files, including 
> partial content of music files @cache.action() def download(): return 
> response.download(request, db) " > 
> applications/audio/controllers/default.py 
> After a file is uploaded into the DB. How could I access it via a view or 
> controller? I tried using the dal, but it doesn't seem to work. Does my 
> question make sense?
>
> On Wednesday, November 5, 2014 11:19:17 PM UTC-5, LoveWeb2py wrote:
>>
>> *Hello,*
>>
>> *I'd like to play an audio file in my view once a certain condition is 
>> met.*
>>
>> *I'm using Massimo's audio setup (thank you, Massimo!!) found here:*
>>
>> *https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/
>>  
>> *
>>
>> *How could I stream/play the audio from the database where I uploaded the 
>> files. I would post my model/controller but its all in the link above.*
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: registration settings not working

2014-11-17 Thread Massimo Di Pierro
what is not working?

On Monday, 10 November 2014 04:21:31 UTC-6, Yebach wrote:
>
> Hello
>
> In my db.py i have the following settings
>
> auth.settings.registration_requires_verification = True
> auth.settings.registration_requires_approval = True/False  - it is always 
> Fasle - user can login even if I set to True??
> auth.settings.reset_password_requires_verification = True
>
>
> mail=Mail() 
> auth.settings.mailer=mail
> mail.settings.server=':25'
> mail.settings.sender='sen...@algit.si'
> mail.settings.login=':pass'
> mail.settings.tls = False
>   
> auth.messages.verify_email = 'Click on the link 
> http://'+request.env.http_host+URL(r=request,c='default',f='user',args=['verify_email'])+'/%(key)s
>  
> to verify your email'
> auth.settings.reset_password_requires_verification = True
> auth.messages.reset_password = 'Click on the link http://'+\
>   request.env.http_host+\
>   URL(r=request,c='default',f='user',args=['reset_password'])+\
>   '/%(key)s to reset your password'
> 
>
> none of this seems to be working.
> Mail server is ok because 
> mail.send('vi...@net.si',  'Message subject',  'Plain 
> text body of the message') is working
>
>
> Any suggestions?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: second page to be accessed only from first page

2014-11-17 Thread Cliff Kachinske
I believe the book is correct. Are you sure the redirect doesn't work?

request.function should be "second" if that was the requested function. The 
redirect occurs after the request is parsed.

On Saturday, November 15, 2014 4:58:15 AM UTC-5, T.R.Rajkumar wrote:
>
> In book chapter 3 overview the following is given to restrict access to 
> second page. 
>
> if not request.function=='first' and not session.visitor_name:
> redirect(URL('first'))
>
> But if I print request.function it says 'second'.
> How to restrict access to second page only from first page?
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: pagination issue redirecting to the current page

2014-11-17 Thread Cliff Kachinske
Put information about the current page in the request.args dictionary. You 
could use the session, but if your user opens a second browser window it 
becomes difficult to keep track of which session data corresponds to which 
browser tab.

On Friday, November 14, 2014 8:37:25 PM UTC-5, Joe wrote:
>
> I am working on an app where the user can select items by clicking on a 
> button for each item on the index page. It works fine, except after each 
> item selected the user has to be redirected to index and ends up on the top 
> of the first page at item 1. Then the user has to go back each time and try 
> to find whatever page they were on before when they made the last 
> selection. How can I fix this so when the user selects the item, he is 
> redirected to the same page?
>
> def index():
> if len(request.args):
> page=int(request.args[0])
> else:
> page=0
> items_per_page=11
> limitby=(page*items_per_page,(page+1)*items_per_page + 1)
> rows=db().select(db.post.ALL, limitby=limitby)
> form = SQLFORM(db.post)
> if form.process().accepted:
> redirect()
> selected = db(db.post.selected == True).select()
> not_selected = db(db.post.selected == False).select()
> return dict(form=form, selected=selected, not_selected=not_selected, 
> rows=rows, page=page, limitby=limitby,items_per_page=items_per_page)
>
> def select():
> id = request.vars.id
> name = db(db.post.id == id).select().first()
> if name:
> name.selected = not name.selected
> name.update_record()
> return redirect(URL('index'))
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Fill a field based on the value from another autocomplete field

2014-11-17 Thread Carl Petersen
So what I'd like to do is once a user makes a selection from the drop down 
of an autocomplete field (for instance selecting a customer) in a view , 
I'd like to immediately update the address, city and state fields on the 
same view.  How would I go about that?

Thanks,

Carl

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: [web2py:9210] Python print from Mac OSX app version of web2py

2014-11-17 Thread Cristian Gonzalez
I'm not too familiar with Console, could you explain how to filter it so it 
only shows web2py material?
On Wednesday, September 17, 2008 11:40:39 AM UTC-7, Massimo Di Pierro wrote:
>
> It goes in the OSX console. Type "console" in finder.
>
> Massimo
>
> On Sep 17, 2008, at 12:46 PM, Scott Hunter wrote:
>
> >
> > If I run web2py as a Mac OSX app, and I execute a Python "print"
> > command, where does its output go?  I've checked at the Console app &
> > the console window that web2py brings up, but (obviously) didn't find
> > what I'd printed.
> >
> > Thanks in advance,
> > Scott
> >
> > >
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] pagination issue redirecting to the current page

2014-11-17 Thread Joe
I am working on an app where the user can select items by clicking on a 
button for each item on the index page. It works fine, except after each 
item selected the user has to be redirected to index and ends up on the top 
of the first page at item 1. Then the user has to go back each time and try 
to find whatever page they were on before when they made the last 
selection. How can I fix this so when the user selects the item, he is 
redirected to the same page?

def index():
if len(request.args):
page=int(request.args[0])
else:
page=0
items_per_page=11
limitby=(page*items_per_page,(page+1)*items_per_page + 1)
rows=db().select(db.post.ALL, limitby=limitby)
form = SQLFORM(db.post)
if form.process().accepted:
redirect()
selected = db(db.post.selected == True).select()
not_selected = db(db.post.selected == False).select()
return dict(form=form, selected=selected, not_selected=not_selected, 
rows=rows, page=page, limitby=limitby,items_per_page=items_per_page)

def select():
id = request.vars.id
name = db(db.post.id == id).select().first()
if name:
name.selected = not name.selected
name.update_record()
return redirect(URL('index'))

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Mapping a URL to a certain controller/function while not showing the app name as part of the URL

2014-11-17 Thread Erik
I basically want either *http://localhost/shop *or* 
http://localhost/shop/shoes* to route to index() in shop.py. Is that 
possible?

File *shop.py*:

def index:
   return dict()



On Friday, November 7, 2014 6:46:36 PM UTC-8, Anthony wrote:
>
> It's not quite clear what you want. Is "shoes" a controller, and if so, 
> are you saying you don't want it to appear in the URL but instead want it 
> to be the default controller? If so, just set default_controller='shoes'.
>
> Anthony
>
> On Friday, November 7, 2014 8:09:48 PM UTC-5, Erik wrote:
>>
>> I'm using the* parameter based* system for routing. I have the following 
>> in my routes.py:
>>
>> routers = dict(
>> BASE=dict(
>> default_application='myapp',
>> )
>> )
>>
>> When I open http://127.0.0.1:8000/shop I see the same content as I would 
>> see in *http://127.0.0.1:8000/myapp/shop 
>>  *which is great since I don't want 
>> the app name to show in the URL. 
>>
>> Now I'm trying to figure out how can I map something like 
>> *http://127.0.0.1:8000/shop/shoes 
>> * to *http://127.0.0.1:8000/shop 
>> *? *http://127.0.0.1:8000/shop/shoes 
>> * should be in the URL but behind the 
>> scenes it should actually be pointing to just *http://127.0.0.1:8000/shop 
>> *.
>>
>> Seems it's possible to do it using the *Pattern-based* approach, but 
>> when I do that way then I can't seem to hide the app name in the URL.
>>
>> Any ideas? Thanks in advance!
>>
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Convert MongoDB / dict into a DAL Row

2014-11-17 Thread Francisco Tomé Costa
Performance, some collections (tables) have lots of references fields and
have poor select performance using the DAL
On Nov 14, 2014 6:40 PM, "Leonel Câmara"  wrote:

> Why are you talking to mongodb directly? This completely ruins the purpose
> of using a DAL.
>
> What's happening here is that when you do:
>
> print(Row(user))
>
> Row.__str__ is called which in turn calls Row.as_dict, well Row.as_dict
> does not know how to serialize ObjectId so it just ignores it.
>
> One thing you can do is to convert the value of ObjectId before putting it
> in the Row.
>
> Frankly this seems all sorts of wrong, and you should just use the last
> syntax you have shown which does this conversion for you and does work.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/KY5fnKopbsU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Comments/notes and api documentation

2014-11-17 Thread Dennis Jacobs
Hi Limedrop,

I've checked both "components", and it's unclear how the medium-notes are 
stored and retrieved.
Do you happen to know if the medium-notes require a database to store these 
notes?
Cause apearantly it was decided to avoid using databases for the book, 
mainly due to performance issues.
(see github issue 232, found here 
).

Now even if the medium-notes does require a db, the jquery clone does not!
So we should be able to implement at least the clone.
But then the question remains, how are we going to store these notes?

With kind regards,
Jacobs Dennis.

On Thursday, September 18, 2014 3:17:56 AM UTC+2, Limedrop wrote:
>
> Have you seen the medium.com in-context notes?  That would be a great way 
> to bring it all together:
>
> https://medium.com/about/why-medium-notes-are-different-and-how-to-use-them-well-5972c72b18f2
>
> There's even a jQuery clone that could be used:
> https://github.com/aroc/side-comments
>
>
> On Thursday, September 18, 2014 11:07:44 AM UTC+12, Derek wrote:
>>
>> I'd like to see a wiki... it could be run on web2py even...
>>
>> On Tuesday, September 16, 2014 3:12:52 PM UTC-7, Anthony wrote:
>>>
>>> Maybe submit a Github issue in the book repo requesting this feature.
>>>
>>> Anthony
>>>
>>> On Tuesday, September 16, 2014 6:12:06 PM UTC-4, Anthony wrote:

 Agreed, but for the most part, if something is truly lacking from the 
 documentation, it would be best if it could be included in the 
 documentation itself, rather than in a long list of unorganized comments 
 at 
 the bottom of the page. You can always make a pull request on the book 
 repo 
 (https://github.com/mdipierro/web2py-book) for direct changes to the 
 documentation.

 Allowing user comments/feedback isn't a bad idea, though, but we would 
 probably have to change the UI -- currently each chapter is a very long 
 HTML page, and putting comments at the bottom would in many cases place 
 them very far from the relevant context in the chapter.

 Note, the old version of the book did in fact allow comments at the 
 bottom of each page (though there was no upvote/downvote feature), but 
 that 
 functionality was not migrated to the newer book app.

 Anthony

 On Tuesday, September 16, 2014 6:02:42 PM UTC-4, Robin Manoli wrote:
>
> It's not really what I'm looking for. There are many benefits to the 
> php documentation way:
> 1. the comments are where you are looking for help
> 2. when you are looking for help, and find a solution of your own, you 
> can post it where you were looking
> 3. the current documentation is unclear in many places, and it's not 
> very efficient to browse around the form/slices/stackoverflow/examples to 
> get to the solution, when it could already be there where you look first
> 4. the documentation could become verbose instead of lacking
> 5. there are many little tricks that i have read about in the forum 
> that i couldn't find in the documentation... if all these tricks would be 
> more accessible, web2py's many hidden features could be used more
>
> Den torsdagen den 11:e september 2014 kl. 00:27:10 UTC+2 skrev Anthony:
>>
>> It's not embedded with the main documentation, but for user 
>> contributed content, we do have http://www.web2pyslices.com/home.
>>
>> Anthony
>>
>> On Wednesday, September 10, 2014 5:55:36 PM UTC-4, Robin Manoli wrote:
>>>
>>> Hey,
>>> the php documentation has user comments with examples of how to use 
>>> different functions. This is a great complement to their documentation.
>>>
>>> With web2py I have stumbled upon many things in these forums that I 
>>> have not seen in the documentation. I'm not sure how often you update 
>>> it, 
>>> since I keep finding new things there too.
>>>
>>> Still, don't you think it would be better if we all could contribute 
>>> with common and examples to an api-type of documentation for web2py? I 
>>> think the php documentation does this really well.
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] PythonAnywhere 405 Not Allowed - response.js problem?

2014-11-17 Thread Rob0
I have a web2py form page which works locally, and on ubuntu running on ec2 
at Amazon.
I'm trying to set it up at pythonanywhere and I'm getting an error: 405 Not 
Allowed

I don't receive a web2py ticket or any other errors in the error log.  I 
don't see any errors using firebug.
I believe I've narrowed it down to the response.js for the SQLFORM.grid of 
search results.

Simplified / Shortened code:

-
index.html:
{{=LOAD('default','ask.load',ajax=True)}}




ask.load:
{{=form.custom.begin}}
---a customized form ---
{{=form.custom.end}}


default.py
def index():
return locals()
 
ask():
 #setup the query and other options
 data=SQLFORM.grid(query=query,fields=fields,formstyle='divs',csv=False,
searchable=False,paginate=15)
 response.js = "jQuery('{}').html('{}');".format("#results",data)



-

Here's what's strange - I can return simple results via the web2py 
response.js method like this, 
data = "Hello World" 
response.js = "jQuery('{}').html('{}');".format("#results",data)
I can return a simple html response like:
data = "Hello World" 
response.js = "jQuery('{}').html('{}');".format("#results",data)
that all works. But the table of results from SQLFORM.grid doesn't work. 

So I figured something was wrong with the table, even though it's being 
created by a standard web2py component SQLFORM.grid

However if I pass the table back not via response.js the table renders fine.

I rewrote the application so instead of using {{=LOAD...}} I chagned ask() 
to index() and put the whole custom form in index.html
Then instead of using response.js I simply passed back {{=data}} to the 
page.  That works.  So it seems the SQLFORM.grid data 
is OK to PythonAnywhere since it renders fine if return it instead of using 
response.js.

I would like to use the ajax methodology instead since as I add more 
features to the page I don't want to be reloading everything.

Is there a problem with ask() which is called via LOAD from index, updating 
a  on index?  
If so why would it work locally?  As well as on an ubuntu instance on EC2?

Any thoughts?  Suggestions?  Could it be a setup issue at PythonAnywhere, 
(which I think is nginx and uwsgi)?
I've asked at PA, but I think it's a hard question for them to answer.

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] smartgrid - export to pdf

2014-11-17 Thread Alen Cerovic
Hi,

what is standard (read easy ;-) way to export smartgrid to pdf
I tried replacing http://127.0.0.1:8000/app/controller/index to 
http://127.0.0.1:8000/app/controller/index.pdf but got an error:
 Table column/cell width not specified, 
unable to continue

Please help

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How do you issue a command to the operating system in web2py?

2014-11-17 Thread BitHui
I'm trying to run a shell command in Linux from web2py?  Is that possible 
and how would you accomplish that?  Thanks in advance.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column order

2014-11-17 Thread Alex Glaros
In grid, can fields argument name virtual fields?

Or can it only use fields from the table?

If it can, what is the format?

Alex

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column order

2014-11-17 Thread Anthony
I lobbied to rename the "links" argument a while ago, as it is not just for 
links -- the content of a "link" column can literally be anything at all.

Anthony

On Monday, November 17, 2014 7:12:15 PM UTC-5, Alex Glaros wrote:
>
> okay, I get it. To get granular control over every individual column, I 
> move all columns to links. Also, I didn't know that links don't have to 
> be href links.
>
> I'm assuming I can't use the fields argument to move some of the virtual 
> link fields to the left and some to the right of the table fields.
>
> thanks,
>
> Alex
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column order

2014-11-17 Thread Alex Glaros

>
>
> I'm assuming I can't use the fields argument to move some of the virtual 
> link fields to the left and some to the right of the table fields.
>

I mean fields argument cannot name virtual fields, correct?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column order

2014-11-17 Thread Alex Glaros
okay, I get it. To get granular control over every individual column, I 
move all columns to links. Also, I didn't know that links don't have to 
be href links.

I'm assuming I can't use the fields argument to move some of the virtual 
link fields to the left and some to the right of the table fields.

thanks,

Alex

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Query of two dates sql server

2014-11-17 Thread José Eloy
Hi!

I'm having troubles in making a query with 2 dates in SQL Server 2005.

First, my table definition:

db2.define_table('tabla_datos',
Field('na', requires=IS_NOT_EMPTY()), 
Field('fecha', 'datetime', requires=[IS_NOT_EMPTY(), 
IS_DATETIME(format=T("%d/%m/%Y %H:%M:%S"), error_message='Debe ser 
DD-MM- HH:MM:SS!')]),
Field('ta', db2.tipos_de_asunto),
Field('unidad',  requires=IS_NOT_EMPTY()),
Field('operador'),
Field('carta', requires=IS_NOT_EMPTY()),
Field('importe', 'decimal(15,2)', requires=IS_NOT_EMPTY()),
Field('observaciones') 
)

In my controller I receive from a form (via ajax) two dates for searching 
in the database:

def busca_consulta():

num_asunto = request.post_vars.input_na   
desde = request.post_vars.input_desde   # User write a date using 
the Web2py widget. Format: %d/%m/%Y (time is not necessary)
hasta = request.post_vars.input_al   # User write a date 
using the Web2py widget. Format: %d/%m%Y (time is not necessary)

rows= db2(((db2.tabla_datos.fecha>=desde) & 
(db2.tabla_datos.fecha<=hasta)) & (db2.tabla_datos.na==num_asunto)).select()
 
but I get error, Is it necessary to convert the variables "desde" and 
"hasta" to datetime? How can I convert them?

I've checked the SQL Server datetime format, the datetime is saved in the 
records using the following format: %Y-%d-%m %H:%M:%S. I live in Mexico, 
the format we use is: %d/%m/%Y %H:%M:%S

My english is not very good, I hope you can understand me.

Regards.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column order

2014-11-17 Thread Niphlod
The question is a taddle bit unclear
If the link is a field of the table, shifting colums is as easy as using 
the fields argument with your own order. 
By default it's the same order fields are defined in your models.

Why are you building the A element with a represent? There's the "links" 
argument that was made exactly for the purpose you can choose where 
links (and default edit, view, delete buttons) are rendered using 
buttons_placement and links_placement parameters... try setting them to 
"left" :-P

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] grid column order

2014-11-17 Thread Alex Glaros
I want the first column in grid to be a link. It's an already-existing 
field in a table and displays in the correct order when not linkable.

Is using "represent" the only way to make this column in this 
first-position a link?

If I use the links= statement, the column is displayed to the right, 
instead of at the first column on the left.

thanks,

Alex Glaros

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Convert MongoDB / dict into a DAL Row

2014-11-17 Thread António Ramos
By the way, how is web2py support for Mongo ?
I only find old post about it.

Is it safe to use Mongo with Web2py ?

Is the DAL 100% compatible with mongo ?

Regards
António


2014-11-15 13:02 GMT+00:00 Alan Etkin :

> Row.__str__ is called which in turn calls Row.as_dict, well Row.as_dict
>> does not know how to serialize ObjectId so it just ignores it.
>>
>
> I don't recall exactly (perhaps I should check the source), but I think
> the mongodb adapter doesn't support dealing with pure objectid objects for
> database I/O. What it does is always convert from/to long integers because
> objectid objects are mapped to web2py db record ids. So, you should not be
> able to work with objectid instances and DAL unless you only store and
> retrieve id values.
>
> @Francisco: about your question on cache not working with mongo, I
> wouldn't say, maybe there is a bug in the adapter. AFAIK the caching of
> rows on selects should work with mongodb as well.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Error Assigning tasks

2014-11-17 Thread António Ramos
Thank u for the tip

António

2014-11-17 15:45 GMT+00:00 Niphlod :

> apart from "update web2py" (2.0.9 is so old that my brain hurts), trying
> lowering the number of workers. That error means that your database can't
> keep up with the workers.
>
>
> On Monday, November 17, 2014 3:16:25 PM UTC+1, Ramos wrote:
>>
>> Hello i have this error i started 10 workers but only have 8 tasks.
>> Thank u
>>
>>
>> [image: Imagem inline 1]
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: crud edit

2014-11-17 Thread Richard Vézina
Don't have time to study your problem carefully... Though I guess you can
pass your var throught session.var from parent controller to child
controller... To do that, once your parent form is accepted you just iter
over you form.vars or just pass the vars one at an time...

for var in form.vars:
sesssion[var] = form.vars[var]

or

session.var1 = form.vars.var1

Make sure you clean your session in case your controller is bugged and get
accepted even if there is field entries missing because in this given case
the session.var will still be assign to the precedent var value...

Other possibility is to redirect to child form enclose in an component and
pass you vars throught url with vars attribute from URL(). You maybe need
web2py_component() instead of redirect to update the enclosed subform...

What I usually do for parent and child form is to use component and load
the component with web2py_component() once form is accepted...

Hope it helps.

Richard

On Fri, Nov 14, 2014 at 6:50 PM, Alex Glaros  wrote:

> thanks Richard
>
> 1. will update CRUD later but need to finish project now; sqlFORM raises
> errors I can't solve for this one function.
>
> 2. can you please tell me how to get these two vars from grandparent to
> persist so that child can return to parent?
>  vars=dict(filter=db.SuperObjectComment.superObjectID, id=
> db.SuperObjectComment.id
>
> thanks,
>
> Alex
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error Assigning tasks

2014-11-17 Thread Niphlod
apart from "update web2py" (2.0.9 is so old that my brain hurts), trying 
lowering the number of workers. That error means that your database can't 
keep up with the workers.

On Monday, November 17, 2014 3:16:25 PM UTC+1, Ramos wrote:
>
> Hello i have this error i started 10 workers but only have 8 tasks.
> Thank u
>
>
> [image: Imagem inline 1]
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Error Assigning tasks

2014-11-17 Thread António Ramos
Hello i have this error i started 10 workers but only have 8 tasks.
Thank u


[image: Imagem inline 1]

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Another import problem

2014-11-17 Thread Johann Spies
Solved:  __init__.py was also missing in the top directory of the app.

Thanks for your help.

Johann



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.