[web2py] Re: Web2py - How to update a table field appending a string to an existing field value

2016-09-18 Thread Meinolf
Excellent, the None value was indeed the problem, so i just gave a default 
string value in the table definition as *Field('search_term', 'string', 
default='')* and now it works. Thanks a lot.

On Monday, September 19, 2016 at 4:59:00 AM UTC+2, Massimo Di Pierro wrote:
>
> This works for me, I just tried:
>
> >>> db.define_table('rated_items',
>
> Field('search_term','string'),
>
> )
>
>
> >>> k = db.rated_items.insert(search_term='a')
>
> >>> db(db.rated_items.id
> ==k).update(search_term=db.rated_items.search_term+'b')
>
> >>> print db.rated_items[k]
>
> 
>
>
> you probably have None into the search_term field and it cannot be 
> concatenated with string.
>
> On Friday, 16 September 2016 05:44:36 UTC-5, Meinolf wrote:
>>
>> I had tried that and tried it just now but still gives a None value in 
>> the rated_items.search_term field. maybe it's got to do with the table def; 
>> my table definition is as follows:
>>
>> db.define_table('rated_items',
>> Field('search_term','string'),
>> Field('user_id', 'reference auth_user', default=auth.user and 
>> auth.user.id),
>> Field('item_id', 'integer'),
>> Field('clicks', 'integer', default=0),
>> migrate=True,
>> )
>>
>> On Friday, September 16, 2016 at 12:00:09 AM UTC+2, Meinolf wrote:
>>>
>>> Hi there
>>>
>>> So far i only know how to update a record by replacing the old field 
>>> value with the new value. Suppose i want to append the search_term string 
>>> value the corresponding text field so that both values are stored, how can 
>>> i do that in this code:
>>>
>>> myrow = db((db.rated_items.user_id==auth.user.id) & 
>>>  
>>> (db.rated_items.item_id==request.args(0))).update(search_term=str(request.vars.search_term)
>>>
>>> Would appreciate any 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] Re: Translation best practice

2016-09-18 Thread pbreit
The English strings get added to the files in the "Languages" directory and 
so you should just be able to give your translator the appropriate file 
from that directory.

Spanish, for example:

'Clear RAM': 'Limpiar RAM',
'Click on the link %(link)s to reset your password': 'Pulse en el enlace 
%(link)s para reiniciar su contraseña',
'click to check for upgrades': 'haga clic para buscar actualizaciones',
'client': 'cliente',
'Client IP': 'IP del Cliente',
'Close': 'Cerrar',


On Sunday, September 18, 2016 at 3:43:09 PM UTC-7, icodk wrote:
>
> I have a  web2py application, where all  text is in/are: T("text in 
> English") Now I need to translat it to another language, even found a 
> person willing to do it. What will be the best way to give him  language 
> file so he can translate it without giving him access to the administration 
> of the site ? As to start with, he don't have to see the context 
> immediately, just to translate most of the easy staff.
> 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] Re: Fetching rows with st_asgeojson()

2016-09-18 Thread Massimo Di Pierro
How about this?

features = []
for event in events:
link = A(event[db.events.title], _href=URL('default', 'event_page', 
vars=dict(event_id=event[db.events.id]))).xml()
item = {
"type": "Feature",
"popupContent": link,
"track_quotation": str(event[db.events.track_quotation]),
"geometry": loads_json(event[db.events.geometry.st_asgeojson()])
}
features.append(item)





On Saturday, 17 September 2016 12:57:29 UTC-5, Gael Princivalle wrote:
>
> Someone have an idea?
>
> Here is the code that works:
> features= [{"type": "Feature",
> "properties": {
> "popupContent": " 'event_page', vars=dict(event_id=event[db.events.id])) + "'>" + 
> event[db.events.title] + "",
> "track_quotation": 
> str(event[db.events.track_quotation])
> },
> "geometry": 
> loads_json(event[db.events.geometry.st_asgeojson()])} for event in events]
>
> But I would like to traduce it in a loop like that:
> for event in events:
> ...
>
> Il giorno martedì 13 settembre 2016 15:36:32 UTC+2, Gael Princivalle ha 
> scritto:
>>
>> Hello.
>>
>> Can someone explain me why when I use this set of rows:
>> events= db(db.events.id>0).select(db.events.id, db.events.title, 
>> db.events.geometry.st_asgeojson())
>> I can't call my rows with event.title but with event[db.events.title] ?
>>
>> It's a problem because if I would like to call for a reference field like 
>> event[db.events.category.category_name] ticket is wrong attribute.
>>
>> 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] Re: Web2py Solr UI

2016-09-18 Thread Massimo Di Pierro
The build_query is not efficient. It uses the LIKE operator therefore it 
does not uses proper full text search.
Full text search builds an index of keywords and can efficiently search 
them inside text.
Whoosh, Solr, and other libraries to that. Haystack is a wrapper named 
after the equivalent Django module.


On Friday, 16 September 2016 10:05:29 UTC-5, Ron Chatterjee wrote:
>
> I never used heystack so its interesting. How the heystack has advantage 
> over this?
>
> query = SQLFORM.*build_query*(list_of_searchable_fields,search_text)
>
>
>
>
>
> On Thursday, September 15, 2016 at 6:51:25 PM UTC-4, Donald McClymont 
> wrote:
>>
>> Massimo has also posted this as a starting point 
>> https://github.com/mdipierro/web2py-haystack  which may be a useful 
>> starting point- I haven't used with solr but did manage to extend to GAE 
>> Search without too much difficulty.
>>
>> Regards
>> Donald
>>
>> On Wednesday, September 14, 2016 at 4:42:55 PM UTC+1, Massimo Di Pierro 
>> wrote:
>>>
>>> You can ask here. If we can help for free so that everybody benefit the 
>>> better. If instead you have private code and do not want to show, please 
>>> contact one of the companies doing web2py support listed from the web2py 
>>> page.
>>>
>>> On Wednesday, 14 September 2016 08:37:21 UTC-5, Morris Fourie wrote:

 I need assistance with Web2py and Solr UI. I am new and not at the 
 right level yet but am willing to pay. I hope I am at the right forum and 
 come anyone help
 Thanks
 Mo





-- 
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 - How to update a table field appending a string to an existing field value

2016-09-18 Thread Massimo Di Pierro
This works for me, I just tried:

>>> db.define_table('rated_items',

Field('search_term','string'),

)


>>> k = db.rated_items.insert(search_term='a')

>>> db(db.rated_items.id==k).update(search_term=db.rated_items.search_term+
'b')

>>> print db.rated_items[k]




you probably have None into the search_term field and it cannot be 
concatenated with string.

On Friday, 16 September 2016 05:44:36 UTC-5, Meinolf wrote:
>
> I had tried that and tried it just now but still gives a None value in the 
> rated_items.search_term field. maybe it's got to do with the table def; my 
> table definition is as follows:
>
> db.define_table('rated_items',
> Field('search_term','string'),
> Field('user_id', 'reference auth_user', default=auth.user and 
> auth.user.id),
> Field('item_id', 'integer'),
> Field('clicks', 'integer', default=0),
> migrate=True,
> )
>
> On Friday, September 16, 2016 at 12:00:09 AM UTC+2, Meinolf wrote:
>>
>> Hi there
>>
>> So far i only know how to update a record by replacing the old field 
>> value with the new value. Suppose i want to append the search_term string 
>> value the corresponding text field so that both values are stored, how can 
>> i do that in this code:
>>
>> myrow = db((db.rated_items.user_id==auth.user.id) & 
>>  
>> (db.rated_items.item_id==request.args(0))).update(search_term=str(request.vars.search_term)
>>
>> Would appreciate any 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] pysqlite2.dbapi2.OperationalError'> near "<": syntax error

2016-09-18 Thread Peter

I got the error above while trying to rewrite and tidy up some code that I 
had working but didn't do everything I wanted.
This is a lot neater but it doesn't work yet I think I am close!
 
I have a person table and a task table where task.person is type 
'references person' 

This is the code (not working and has never worked) so all I can say is I 
know it's wrong... 

def generate_inv_details():

session.inv_details = []
session.inv_total = 0
today = datetime.date.today()

query = db( (db.task.person.belongs( session.company_persons)\
  & (db.task.start_time <= today )\
  & (db.task.charge_to == 'COMPANY' )\
  & (db.task.task_status == 'BILLABLE')))

rows=db(query).select( db.task.person,\
   db.task.person.name,\
   db.task.title,\
   db.task.start_time,\
   db.task.duration,\
   db.task.task_type,\
   db.task.task_status,\
   db.task.charge_to,\
   db.task.charge,\
   db.task.payment_status )

session.inv_details=rows

for row in session.inv_details:
session.inv_total += row.task.charge

 
Is this totally off the wall and not even close?  
Is there a problem with the format of the select statement? (which I 
suspect is the issue)  or 
Is there a glaring problem elsewhere?

You will have to trust me when I say I have put hours of frustration and 
reading into this and I only post here as a last resort!

Many thanks for your consideration!

Peter

-- 
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] Translation best practice

2016-09-18 Thread icodk
I have a  web2py application, where all  text is in/are: T("text in 
English") Now I need to translat it to another language, even found a 
person willing to do it. What will be the best way to give him  language 
file so he can translate it without giving him access to the administration 
of the site ? As to start with, he don't have to see the context 
immediately, just to translate most of the easy staff.
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] Re: web2py on android

2016-09-18 Thread eric cuver
you can use local storage for example :

var objet = { propriete1 : "valeur1", propriete2 : "valeur2" }; var 
monobjet_json = window.JSON.stringify(monobjet); window.localStorage
.setItem("objet",monobjet_json);

Le dimanche 18 septembre 2016 01:39:01 UTC+2, JorgeH a écrit :
>
> what if I need to store data in the mobile when there is no internet 
> connection and sync with the webserver when there is connection?
>
> what db or sqlite, can I use?
>
> On Saturday, July 23, 2016 at 1:03:24 AM UTC-5, eric cuver wrote:
>>
>> you can use cordova wbeview and used side client brython( python) and 
>> backend web2py
>> I create the applications in this way it works very well 
>>
>> Le mardi 19 juillet 2016 13:16:10 UTC+2, Paolo Amboni a écrit :
>>>
>>> Is it possible to do something like that with web2py?
>>>
>>> Android apps with Python, Flask and a WebView 
>>> 
>>> (
>>> https://kivy.org/planet/2016/05/android-apps-with-python-flask-and-a-webview/
>>> )
>>>
>>> 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] Re: Form forget selected file

2016-09-18 Thread Anthony
In order to re-fill the file selection, you would have to know the file 
path on the user's machine, but the browser does not send this information 
due to security concerns, so you cannot maintain file selections across 
page reloads. You would either have to submit (or at least validate) the 
form via Ajax so you can keep the initial version of the form on the page, 
or temporarily store the uploaded file on the server when there is an error 
so the user doesn't have to upload it again on the re-submission. web2py 
does not include built-in logic for either of these approaches, so you will 
need some custom code.

Anthony

On Sunday, September 18, 2016 at 10:37:59 AM UTC-4, Gael Princivalle wrote:
>
> Hello all.
>
> When a form is submitted with errors, if the user have choose first a file 
> in this form, this choice is not reminded for the next submission attempt.
>
> Is there's a way to remind this choice?
>
> 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] Form forget selected file

2016-09-18 Thread Gael Princivalle
Hello all.

When a form is submitted with errors, if the user have choose first a file 
in this form, this choice is not reminded for the next submission attempt.

Is there's a way to remind this choice?

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] Re: booking/event calendar

2016-09-18 Thread icodk
Thank you both 
Looks great

On Saturday, September 17, 2016 at 12:30:54 AM UTC+2, icodk wrote:
>
> Looking for a front end event/booking calendar to be used in web2py 
> application.
> I actually found 49 on github (searching for javascript event calendar). 
> Just before I try them all, would be thankful to hear others experience.
> 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.


Re: [web2py] booking/event calendar

2016-09-18 Thread António Ramos
+1 FullCalendar...

2016-09-18 7:10 GMT+01:00 Niphlod :

> Go for fullcalendar
>
> --
> 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: Migrating Postgres to MySql

2016-09-18 Thread Joe Barnhart
When I first started using MySql awhile ago (after having used Postgres 
longer) I was screaming mad all the time.  I absolutely hated MySql and the 
crap it put me through.  That was a few years back, and I can't quite 
remember what made me so mad.  Other than performance, of course.  I feel 
Postgres may have the upper hand in some areas of performance, but to be 
honest correctly "tuning" a DBS is such a difficult topic that few of us 
really master it.  I certainly never have.

My interest in MySql is purely because it is more widely available in the 
commercial server-for-hire world.  Left alone I probably would have happily 
continued using Postgres.

On Saturday, September 17, 2016 at 6:39:55 PM UTC-7, junde...@launchpnt.com 
wrote:
>
> Joe, I'd be curious to know how you feel MySql performs in comparison to 
> Postgres.
>
>
>

-- 
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] booking/event calendar

2016-09-18 Thread Niphlod
Go for fullcalendar

-- 
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] scheduler and long tasks

2016-09-18 Thread Niphlod
You can have a task that selects and groups and queues for each group the task 
that processes the atom.

-- 
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.