[web2py] Re: how to calculate size of uploads by user

2016-01-13 Thread Niphlod
manual uploads, dude! an upload field is a cgi.FieldStorage object. len(thefieldstorage.value) or you can seek() and tell() , as IS_LENGTH does already -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] import_from_csv_file: how to map columns

2016-01-13 Thread goome
Hi i created i table definition in db.py by using csvstudio.py, but i cannot load the values through db.table.import_from_csv_file becouse the header in the csv have spaces and uppercases. So there a way to tell import_from_csv_file how to map column in csv with that in table definition? By the

[web2py] AttributeError: 'Table' object has no attribute '_primarykey'

2016-01-13 Thread Manuele Pesenti
Hi *, I got this strange error. Where I have to look for the cuase? The table object of my query is defined by: # Note: defined as class parameter table = Table(None, table_name, Field("uuid", unique=True, default=lambda: web2py_uuid()), Field("service", required=True),

[web2py] Re: how to calculate size of uploads by user

2016-01-13 Thread Alex Glaros
am having trouble finding detailed examples. Can you please help with syntax? Am determining size when uploading a user's photo (thumbnail) to their profile: if form.process().accepted: session.flash = 'profile update accepted' file_info =

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Ron Chatterjee
Basically after the file upload, I would like to refresh/reload "show_project_summary.html" to show the list of the file that just been downloaded. On Wednesday, January 13, 2016 at 1:49:42 PM UTC-5, Ron Chatterjee wrote: > > *I have this in my view (show_project_summary.html).* > > > >

[web2py] Re: Why this HTML email not working? Please tell me the corrected version.

2016-01-13 Thread RAGHIB R
this doesn't even send a mail. It doesn't give any error, but using this way doesn't send the mail at all. On Wednesday, January 13, 2016 at 1:21:11 AM UTC+5:30, Niphlod wrote: > > If you read docs about mail.send, you'd know that it takes > > mail.send(to, subject, message, attachments, cc,

[web2py] Re: Why my web2py is running when I haven't downloaded any Mark Hammond's win32 extensions for pywin3?

2016-01-13 Thread Niphlod
probably file locking. On Wednesday, January 13, 2016 at 8:59:56 PM UTC+1, aston...@gmail.com wrote: > > Is it that I am loosing something? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] How do I select and output multiple checkboxes

2016-01-13 Thread Ron Chatterjee
*Model:* db.define_table('mytable', Field('name', type='list:string',requires=IS_IN_SET (('True','False')), widget=SQLFORM.widgets.checkboxes.widget)) *Controller:* def index(): variables = [] form = SQLFORM(db.mytable).process() if

[web2py] Re: update 2 session value using module only first session value work

2016-01-13 Thread Anthony
Presumably you are calling this function as follows: callback_0(session.order, session.sale_order_net) The problem is you later have: session_order_net = dict(...) At that point, you are not modifying the session.sale_order_net object but simply assigning a new object to the local

[web2py] what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Ron Chatterjee
How do I update a current page in its view after a file submission if the redirect doesn't work? {{redirect(URL('show_project_summary', args = Selected_project.id), client_side = True)}} Any response.js that will update or reload/refresh the current page? -- Resources: - http://web2py.com -

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Anthony
Where is: {{redirect(URL('show_project_summary', args = Selected_project.id), client_side = True)}} If that's in a view file for upload_callback, it will never get executed, because upload_callback doesn't return a dictionary. You can call redirect(..., client_side=True) within the

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Anthony
Yes, in the controller, and just us the URL function as usual. Anthony On Wednesday, January 13, 2016 at 2:17:22 PM UTC-5, Ron Chatterjee wrote: > > Yes. That's what I thought too. But what's the correct syntax for > response.js Anthony? > > Is it: > > response.js = 'window.location = "%s";' %

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Ron Chatterjee
Yes. That's what I thought too. But what's the correct syntax for response.js Anthony? Is it: response.js = 'window.location = "%s";' % URL ('default',show_project_summary') ? And I believe I need to invoke that in my controller. Right? On Wednesday, January 13, 2016 at 2:06:34 PM UTC-5,

[web2py] Re: Why this HTML email not working? Please tell me the corrected version.

2016-01-13 Thread RAGHIB R
just tell me how do I include something as session.name1 inside the html body here? On Wednesday, January 13, 2016 at 1:21:11 AM UTC+5:30, Niphlod wrote: > > If you read docs about mail.send, you'd know that it takes > > mail.send(to, subject, message, attachments, cc, .. etc etc etc). > >

[web2py] Why my web2py is running when I haven't downloaded any Mark Hammond's win32 extensions for pywin3?

2016-01-13 Thread aston . ribat
Is it that I am loosing something? -- 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

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Ron Chatterjee
*I have this in my view (show_project_summary.html).* {{ if (submission.created_by == auth.user_id):}} {{pass}} *Script in the same view at the bottom:* jQuery(document).ready(function() { var uploader = new qq.FileUploader({ // pass the dom node (ex.

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Ron Chatterjee
It didn't work. didn't reload it. On Wednesday, January 13, 2016 at 2:20:14 PM UTC-5, Anthony wrote: > > Yes, in the controller, and just us the URL function as usual. > > Anthony > > On Wednesday, January 13, 2016 at 2:17:22 PM UTC-5, Ron Chatterjee wrote: >> >> Yes. That's what I thought too.

Re: [web2py] Re: AttributeError: 'Table' object has no attribute '_primarykey'

2016-01-13 Thread Manuele Pesenti
Il 13/01/16 15:56, 'DenesL' via web2py-users ha scritto: > Which web2py version is that?. > Not sure when objects.py was fixed but the fix is there in 2.12.03 for > sure. Quite an old version... it's a 2.9.12 by the way I've by-passed the problem using theese five lines of code instead of the

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Richard Vézina
Redis keys are stick for ever... I figure out most of how to use the Niphold contrib, though it seems that created cached element stays in Redis for ever... I restart the server and they still there... My issue look like it still there... There maybe something wrong in my logic... It like if

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Anthony
Please show some code. On Wednesday, January 13, 2016 at 1:37:16 PM UTC-5, Ron Chatterjee wrote: > > How do I update a current page in its view after a file submission if the > redirect doesn't work? > > {{redirect(URL('show_project_summary', args = Selected_project.id), > client_side = True)}}

[web2py] Re: what are the ways I can reload or refresh the current page where redirect doesn't work

2016-01-13 Thread Anthony
Check the returned response to ensure the JS is in the header, and check the browser JS console to see if there are any errors. Looks like the JS library you are using also has an onComplete callback, so you could put the reload code in there. Anthony On Wednesday, January 13, 2016 at 2:27:36

[web2py] How can we use variables like session.variable1 inside the html email body?

2016-01-13 Thread RAGHIB R
can you please write a piece of code for 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

[web2py] Re: Why this HTML email not working? Please tell me the corrected version.

2016-01-13 Thread Niphlod
replied already in another post. Please, pretty please, read the book before posting questions! On Wednesday, January 13, 2016 at 8:35:25 PM UTC+1, RAGHIB R wrote: > > just tell me how do I include something as session.name1 inside the html > body here? > > On Wednesday, January 13, 2016 at

[web2py] Re: how to calculate size of uploads by user

2016-01-13 Thread Niphlod
detailed examples are for hard things AND people not willing to experiment :-P it's pretty simple. Given a table with Field('contents', 'upload') any submitted form will have "contents" as a FieldStorage (standard wsgi behaviour). The real deal (or, "the nifty trick") is checking BEFORE

[web2py] Re: How can we use variables like session.variable1 inside the html email body?

2016-01-13 Thread Niphlod
mail.send(to, subject, 'this is the value of variable1 %s' % session.variable1). Don't know why it's difficult to figure out :P On Wednesday, January 13, 2016 at 8:45:07 PM UTC+1, RAGHIB R wrote: > > can you please write a piece of code for it? > -- Resources: - http://web2py.com -

[web2py] Re: web3py

2016-01-13 Thread Massimo DiPierro
It is another experiment. It is a rewrite of some of the web2py modules and supports 90% of the current web2py syntax at 2.5x the speed. It works. It it cleaner and should be easier to port to python 3 than current web2py. We are debating on web2py developers what to do: 1) backport some of the

[web2py] Re: Hide form field

2016-01-13 Thread Massimo Di Pierro
form = SQLFORM.factory( Field('year', label='Year'), Field('month', label='Month'), hidden=dict(fieldname='field value')) On Wednesday, 13 January 2016 11:21:11 UTC-6, desta wrote: > > Thank you Anthony for the help. > > I am not sure how to use this though. Reading the documentation I >

[web2py] Re: multiple instances of a single form on one page

2016-01-13 Thread Massimo Di Pierro
def index(): forms = [SQLFORM(db.table,formname='form%i' % k).process() for k in range(10)] for k,form in enumerate(forms): if form.accepted: print k, form.vars # or do something else return dict(forms = DIV(*forms)) On Wednesday, 13 January 2016 10:58:02 UTC-6,

[web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread Tom Campbell
On Wednesday, January 13, 2016 at 3:38:56 PM UTC-8, Tom Campbell wrote: > > Creating a custom form that relates first name and last name fields to the > db.auth_user's user_id field. In the form below the user ID shows as an > integer in the dropdown but I'd like it to show as the user's name.

[web2py] Re: SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread 黄祥
i think you can use format or represent to achieve it. e.g. *somewhere in models after you define auth tables* custom_auth_table = db[auth.settings.table_user_name] custom_auth_table._format = '%(first_name)s %(last_name)s' *controllers that have SQLFORM.factory that refer to auth_user table*

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Niphlod
hem... cache.ram behaves differently than ANY other backend because it just stores a reference to the computed value . That's why you can do a dict.update() without setting explicitely a new cached value... but you'd need to do if you see it from a "flow" perspective. What you are

[web2py] SQLFORM.factory() - Display name instead of integer for user_id?

2016-01-13 Thread Tom Campbell
Creating a custom form that relates first name and last name fields to the db.auth_user's user_id field. In the form below the user ID shows as an integer in the dropdown but I'd like it to show as the user's name. How do I do that? form = SQLFORM.factory(

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Anthony
On Wednesday, January 13, 2016 at 3:18:10 PM UTC-5, Richard wrote: > > Redis keys are stick for ever... > > I figure out most of how to use the Niphold contrib, though it seems that > created cached element stays in Redis for ever... I restart the server and > they still there... > Are you

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Niphlod
errata corrige on BTW2: on redis, time_expire=None results in key stored at most one day. you can always do time_expire=30*24*60*60 for 30days worth. things_to_know: only cache.disk and cache.ram can effectively cache a value indefinitely and enable that strange behaviour of retrieving the

[web2py] Re: update 2 session value using module only first session value work

2016-01-13 Thread 黄祥
thank you so much for detail explaination, anthony. i found another way around that work fine, don't know is this best practice or not because it hard code to reserve the place in session variable. like describe in the previous post, i want this module function can be used by another functions

[web2py] Field Type Data

2016-01-13 Thread Lorenzo Zonca
Goodmorning to everyone. Through a field "date " with calendar of a CRUD , how can I store a date with this syntax eg . Monday, 2 May - 2016 ( day - number of day - month - year ) Thank you -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Oracle Blob Read

2016-01-13 Thread Rochdi HASSINE
I'm new on web2py and I need to display some images stored in Oracle Database. It s Oracle BLOB fields. -- 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) ---

[web2py] Re: How can we use variables like session.variable1 inside the html email body?

2016-01-13 Thread aston . ribat
Thats not html message @Niphlod here How to display value of here if here is variable -- 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

[web2py] Re: web2pyslices again

2016-01-13 Thread Anthony
> > Please use KISS (keep it simple, stupid) technology. We simple need a page > with very easy list of plugins: Name, Goal, w2p link, repository link - > please NOTHONG more!! Same should see the user who wish use the plugin. > Feel free to build an alternative. > What for stupid peace of

[web2py] Re: import_from_csv_file: how to map columns

2016-01-13 Thread Anthony
I think you'll have to manually change the column names in the file, either by hand or via Python code. Anthony On Wednesday, January 13, 2016 at 7:33:20 AM UTC-5, goome wrote: > > Hi > i created i table definition in db.py by using csvstudio.py, but i cannot > load the values through

[web2py] Re: How to perform a query WITHOUT issuing an orderby to the DB

2016-01-13 Thread Paulo Serrão
Thank you Anthony! Yes I am aware of that issue, that's something I can live with. On Wednesday, 13 January 2016 15:17:05 UTC, Anthony wrote: > > db().select(db.table.ALL, limitby=(0,1000), orderby_on_limitby=False) > > But note that the order of records is not guaranteed to be the same on >

[web2py] Re: Function fails when called from scheduler, but ok when called from a controller/function

2016-01-13 Thread Lisandro
Thanks for the answer. I've found that one of my models does a conditional check on request object. However, when the function is called from the scheduler, there is no HTTP request, so there is no request object. Is there a way to check if request object exists from inside the model? I've

[web2py] Re: AttributeError: 'Table' object has no attribute '_primarykey'

2016-01-13 Thread 'DenesL' via web2py-users
Which web2py version is that?. Not sure when objects.py was fixed but the fix is there in 2.12.03 for sure. Regards, Denes On Wednesday, January 13, 2016 at 8:49:34 AM UTC-5, Manuele wrote: > > Hi *, > I got this strange error. Where I have to look for the cuase? > The table object of my query

Re: [web2py] Re: Can we use a web2py app on Android mobile?

2016-01-13 Thread Mathieu Clabaut
A bit out of topic, but also note that with the help of the nice termux android app, you can develop and run the web2py server on your android… Quite nice when you're far from a real computer… -Mathieu 2016-01-12 16:39 GMT+01:00 eric cuver : > there are several

Re: [web2py] Re: How to perform a query WITHOUT issuing an orderby to the DB

2016-01-13 Thread Richard Vézina
Hello Paulo, If you concern about performance and you don't need all the fields of that table, try to specify them individually you will save some cycle... db.table.ALL is equal to SELECT * Richard On Wed, Jan 13, 2016 at 10:48 AM, Paulo Serrão wrote: > Thank you

[web2py] Re: Function fails when called from scheduler, but ok when called from a controller/function

2016-01-13 Thread Anthony
There is a request object, but it doesn't have all the same attributes during a scheduler run as it does during an HTTP request. Anyway, you can determine whether the current execution is happening via the scheduler by checking request.is_scheduler. Similarly, you can determine if in a shell

[web2py] How to perform a query WITHOUT issuing an orderby to the DB

2016-01-13 Thread Paulo Serrão
Hello everyone! I'm querying a legacy database and for performance issues I can't do an orderby and the end of the SQL (HUGE table). If I do: db().select(db.table.ALL, orderby=db.table.some_key, limitby=(0,1000)) It will issue as supposed: SELECT * FROM table ORDER BY *some_key* LIMIT 1000

Re: [web2py] Re: Can we use a web2py app on Android mobile?

2016-01-13 Thread eric cuver
half of the applications being used are not native. Facebook, uber,instagram etc ... all his companies were not going to rewrite their applications for each platform in java for android, iphone in objective c, blackbery etc ... there is an article on the topic http :

Re: [web2py] Re: Can we use a web2py app on Android mobile?

2016-01-13 Thread eric cuver
there are several solution all depends on your application. facebook use 2 adress url www.facebook.com for the web and when you go through the mobile it is this address that is used https://m.facebook.com/ If you want to create video games for example I think it's better to do it in native.

[web2py] Re: How to perform a query WITHOUT issuing an orderby to the DB

2016-01-13 Thread Anthony
db().select(db.table.ALL, limitby=(0,1000), orderby_on_limitby=False) But note that the order of records is not guaranteed to be the same on repeat calls to the database, so you may get a different 1000 records each time you run that query (that's why the DAL defaults to

[web2py] Re: Hide form field

2016-01-13 Thread Anthony
SQLFORM.factory(..., hidden=dict(fieldname='field value')) Anthony On Wednesday, January 13, 2016 at 11:35:57 AM UTC-5, desta wrote: > > I am generating a form using SQLFORM.factory() and I would like to create > a hidden field. I tried doing this by setting readable and writable to > False,

Re: [web2py] Re: Can we use a web2py app on Android mobile?

2016-01-13 Thread eric cuver
a parenthesis between French Mathieu you're French? Le mercredi 13 janvier 2016 16:50:12 UTC+1, Mathieu Clabaut a écrit : > > A bit out of topic, but also note that with the help of the nice termux > android app, you can develop and run the web2py server on your android… > Quite nice when you're

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Anthony
Are you using nginx/uwsgi? If so, I believe cache.ram would not be shared across the different uwsgi worker processes. You might consider switching to the Redis cache. Anthony On Wednesday, January 13, 2016 at 11:26:16 AM UTC-5, Richard wrote: > > Hello, > > Still struggle with this. I don't

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Richard Vézina
Hello, Still struggle with this. I don't understand why cache dict is not updated in real time... It get updated but there is a strange delay. Thanks Richard On Mon, Jan 4, 2016 at 4:18 PM, Richard Vézina wrote: > UP here! > > Any help would be appreciate... > >

[web2py] multiple instances of a single form on one page

2016-01-13 Thread aetagothno
I'm not sure if this is even possible, but if it is..how would something like this work: You prompt the user for an x amount of days, then with javascript and jquery you have x amount of buttons appear. Each button is an instance of the form. There is a variable within the javascript that

[web2py] Hide form field

2016-01-13 Thread desta
I am generating a form using SQLFORM.factory() and I would like to create a hidden field. I tried doing this by setting readable and writable to False, but the field dissapears from HTML. Is there a way to make it hidden but still accessible in HTML as I want to set its value with Javascript.

[web2py] Re: Hide form field

2016-01-13 Thread desta
Thank you Anthony for the help. I am not sure how to use this though. Reading the documentation I construct my form as follows: form = SQLFORM.factory(¬ Field('year', label='Year', readable=False, writable=True),¬ 57 Field('month', label='Month', readable=False, writable=True ))¬

[web2py] Re: import_from_csv_file: how to map columns

2016-01-13 Thread goome
Thanks for your help! Il giorno mercoledì 13 gennaio 2016 16:38:12 UTC+1, Anthony ha scritto: > > I think you'll have to manually change the column names in the file, > either by hand or via Python code. > > Anthony > > On Wednesday, January 13, 2016 at 7:33:20 AM UTC-5, goome wrote: >> >> Hi

Re: [web2py] simple update of an cache.ram python dict

2016-01-13 Thread Richard Vézina
Ha!! Yes nginx/uwsgi... That what I suspecting, it looks like the dict was kind of unique by user... I think we should leave a note somewhere in the book about this issue... I was in the process of exploring Redis cache or memcache just to see if there were not improvement. I will look into