Hi All,
I am very new to web2py and in general to web framework.
I am trying to read a db content from a remote machine, db is mysql, web2py
version 1.99.7 stable.
I have created a new simple application and added a model db1.py with:
legacy_db = DAL('mysql://username:password@my_server:3306/tim
By default, db.define_table() automatically includes an auto-increment
integer field called "id" to be used as the primary key. If your legacy
table includes an auto-increment integer field with a different name, then
you should specify that field as type "id", and the DAL will use that as
the
>
> session[request.args(0)].id=request.args(0)
>
session[request.args(0)] doesn't exist yet, so you can't refer to an
attribute of it (i.e., "id"). I assume you'd like it to be a Storage object:
from gluon.storage import Storage
session[request.args(0)] = Storage(id=request.args(0))
#
Hi Anthony,
Thanks for your reply, I got the idea of the solution now.
> Finally, do you even need the "id" key, given that it is the same as the
> name of its parent object? Couldn't you just do:
>
> from gluon.storage import Storage
> id = request.args(0)
> session[id] = Storage()
> session
When request.args(0) is 628
> from gluon.storage import Storage
> session[request.args(0)] = Storage(id=request.args(0))
> # now it's a Storage object, so you can start adding new keys
> session[request.args(0)].otherkey = "other value"
>
Is this equivalent to session6 = {'id':6} or 6={'id':6}
I agree the new behavior makes much more sense. Maybe there should be
a backward compatibility flag in Auth?
mic
2012/8/8 Massimo Di Pierro :
> more issues have been addressed. In order to fix an issue I had to introduce
> a slight change of behavior and I am not sure what is the best way to ha
On Friday, August 10, 2012 5:38:27 AM UTC-4, Annet wrote:
>
> When request.args(0) is 628
>
>
>> from gluon.storage import Storage
>> session[request.args(0)] = Storage(id=request.args(0))
>> # now it's a Storage object, so you can start adding new keys
>> session[request.args(0)].otherkey = "o
>
> I changed the expire_sessions.py file to clean up expired sessions, will
> it clean up the sessions created the way above as well?
>
I don't see why not. Note, the above doesn't create the session (web2py
does that) -- it simply adds variables to the session. From the framework
perspective
Hi Anthony.
Thanks for answering my questions, everything is clear now.
Best regards,
Annet
--
Well, I fix it, pointing (action) to my controller from the form:
form = SQLFORM(db.table, request.vars.id[0], _class='formulario',
_id='form_std', keepopts=['sede'], _action=URL())
Thanks
Christian.
El jueves, 9 de agosto de 2012 17:35:23 UTC-4, Christian Espinoza escribió:
>
> Hi, I´m have w
Same error using locals()
:(
On Thu, Aug 9, 2012 at 5:23 PM, Bruno Rocha wrote:
> try to replace return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
> with return locals()
>
> I dont know, but maybe its the problem
>
> On Wed, Aug 8, 2012 at 10:49 PM, Tito Garrido wrote:
>
>> Hi folks,
>>
i haven't test that , i will test and report.
I have been using uwsgi + web2py , and large uploads / downloads all goes
fine. I haven't use Rocket for so long.
On Thu, Aug 9, 2012 at 7:54 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:
> The corruption, as we could determine has to do
When you do
python web2py.py -S yourapp -M -N -R yourscript.py
-M will import your models and run yourscript.py as if it were a controller.
yourscript.py must read the data from where it is (a file?), loop over it,
and do db.table.insert(...)
For example
for name in ['a','b','c']:
db.perso
Which web2py version?
On Friday, 10 August 2012 08:39:40 UTC-5, Tito Garrido wrote:
>
> Same error using locals()
>
> :(
>
> On Thu, Aug 9, 2012 at 5:23 PM, Bruno Rocha
> > wrote:
>
>> try to replace return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE)
>> with return locals()
>>
>> I dont kn
http://killer-web-development.com/section/7/0
Thanks Marco! Really nice.
--
Thank you AngeloC!
On Friday, August 10, 2012 1:50:03 PM UTC+8, AngeloC wrote:
>
> Hi Massimo,
>
> I'm writing it right now to fix ie issues! Please be patient until fixed!
>
> 2012/8/9 Massimo Di Pierro >
>
>> This may be ok but where do I get bootswatch_ie.css from?
>>
>>
>> On Thursday, 9 Augus
May I know if it can be done using Modules (constants.py) instead, and what
would be the difference (performance / best practice etc) ?
Thanks Massimo. Learning along the way.
On Friday, August 10, 2012 9:57:59 PM UTC+8, Massimo Di Pierro wrote:
>
> When you do
>
> python web2py.py -S yourapp -
+1
2012/8/10 Massimo Di Pierro
> http://killer-web-development.com/section/7/0
>
> Thanks Marco! Really nice.
>
> --
>
>
>
>
--
http://www.tecnodoc.com.ar
--
I have a newbie question.
I need to create some record in db on application startup,like for example
default user and other things..
Where is the right script/place to implement it
--
I have a site with a URL like this: www.mydomain/init/foldername/viewname
When I type the URL like this *www.mydomain/init/foldername* I don't get
the static files loaded. However, when I type *www.mydomain/init/foldername/
*(with a backlash at the very end) the static files are loaded OK. What
Hi
Is it possible to trigger the LOAD component when a user clicks on
something, or can it only be used when a page is first loaded?
I have been using the ajax function to do this but would prefer the extra
flexibility of LOAD if it is possible.
thanks
Rob.
--
Here is a quote from an earlier thread:
*Looks like a large number of the issues are actually enhancements, but
they're all labeled as defects*
(Here is a link to the full thread:
https://groups.google.com/forum/?fromgroups#!topicsearchin/web2py/google$20code$20issues/web2py/OUoiAF6ERYs%5B1-
Hi Massimo,
I fixed compatibility with IE and reverted to a non mobile first approach.
I reverted because bootstrap is not mobile first (so we add too little) and
for the sake of compatibility with IE.
Patch is attached to issue
http://code.google.com/p/web2py/issues/detail?id=896 which I cannot
Thank you for your words!
This is what i believe and my team rolls too. (A bit of agile and that
combined).
We have 3 programmers and 1 UI designer and Architect (me) .
On Thu, Aug 9, 2012 at 8:18 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:
> Listen everybody. This thread is hila
This is something simple, but I don't know why it doesn't work.
I want to loop thru form.vars, so
for key, val in form.vars.iteritems():
text += key+': '+val+"\n"
The ticket says val is a 'Reference'?
--
On 10 Aug 2012, at 8:42 AM, Rob_McC wrote:
> To make is same as google user name policy:
> They allow periods, but NOT as a first letter - I added to your RegEx
> I'm almost got it, I want to use exactly what Google uses, (see image
> attached) - I bet this could be on RegEx, but won't have sepa
On 10 Aug 2012, at 8:42 AM, Rob_McC wrote:
> I'm almost got it, I want to use exactly what Google uses, (see image
> attached) - I bet this could be on RegEx, but won't have separate messages
> then.
>
Do you really want separate messages? It's annoying to try different names and
to run into
Once the data have been inserted into the db, the id of the inserted record
is stored in form.vars.id, which is a DAL Reference object. Assuming you
don't want that value, just add a condition testing for key != 'id'. If you
do want the id included, then you can replace val with str(val) in your
Thanks Jonathan.
*Q1:*
*>(Does Google really forbid upper case?)*
. I wouldn't say forbid, but if your name google user name is jonlun, or
jon.lun you can sign in with JonLun, or JON.LUN -
But. I notice* in web2py,* I can have users like JSMITH, jSmith, smith -
and I can't think of a reason
>
> auth.define_tables(username=True)
> db.auth_user.username.requires.insert(0,IS_MATCH("[a-z].*"))
> *the .insert seemed to give me error. *
>
Hmm, it should work. By default, the username field has an IS_MATCH and and
IS_NOT_IN_DB validator, so you should be able to insert into the beginning
Anthony:
Didn't seem right to me either...
*>By default, the username field has an IS_MATCH and and IS_NOT_IN_DB
validator, *
. I did see the web2py regex for that somewhere. and noticed the
appropriate validators.
*Here is what I tested: (using user names)*
0- start a blank web2py app with
Can you show us code for displaying the images?
--
>
> I have a site with a URL like this: www.mydomain/init/foldername/viewname
>
I'm not sure what's going on here, but just for clarification, note that
web2py does not interpret the last two items in the above URL as a view
folder and view name. Rather, those are seen as a controller name and
>
> 3- Try to register him again, and it will not work because of the
> duplicate email address,
> *but if I changed the email address to , jsmithxxx[at]gmail.com *
>and left user name *jsmith* - AND enter a new password, not jsmith's
> password, it lets me in
> to jsmith's origin
Can you explain the consequences of this line in your patch?
if (jQuery(document).width() >= 980)
On Friday, 10 August 2012 10:11:39 UTC-5, AngeloC wrote:
>
> Hi Massimo,
>
> I fixed compatibility with IE and reverted to a non mobile first approach.
> I reverted because bootstrap is not mobile
Anthony:
You're correct about log gin out and back in, but I did gain access to
jsmith's account upon registration,
and* I could (and did)*
* change his password in profile, and now I control his account *-
locking smith out.
I did assume that the "old validator" *would still fire,* and no
Version 1.99.4 (2011-12-14 14:46:14) stableRunning on Apache/2.2.17 (Unix)
mod_wsgi/3.3 Python/2.7.3
On Fri, Aug 10, 2012 at 11:00 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:
> Which web2py version?
>
>
> On Friday, 10 August 2012 08:39:40 UTC-5, Tito Garrido wrote:
>
>> Same error
Dirk posted this on web2pyslices...
To PUT (=update) something, you need to call:
curl -i -H "Accept: application/json" -X PUT --user user:pass -d
"f_entry=something newest"
http://127.0.0.1:8000/RT/default/api/entries/1.json
with id=1 being an existing entry.
So of course, PUT works as update.
On Friday, August 10, 2012 2:12:54 PM UTC-4, Rob_McC wrote:
>
> Anthony:
>
> You're correct about log gin out and back in, but I did gain access to
> jsmith's account upon registration,
> and* I could (and did)*
> * change his password in profile, and now I control his account *-
> locking s
I just did it, within 5 minutes.
Python is already installed on the Raspberry-pi.
- download the sources to the Raspberry
- unpack the zip file
- open a terminal window and go to the directory where it is unpacked
- python web2py.py
that's all.
cheers,
Stef
On 13-03-2012 11:04, António Ramos
I'm in a situation where I just want a single column back from
a table. I'd like it as a list so I could just pass it on
to the next function.
All I can think of is something like:
temp = []
for thing in db(db.mytable).select(db.mytable.myfield):
temp.append(th
mylist = [r.myfield for r in db().select(db.mytable.myfield)]
Anthony
On Friday, August 10, 2012 4:34:01 PM UTC-4, Toby Shepard wrote:
>
>
> I'm in a situation where I just want a single column back from
> a table. I'd like it as a list so I could just pass it on
> to the next function.
>
> A
Thanks Anthony, that worked!
On Saturday, August 11, 2012 12:04:58 AM UTC+8, Anthony wrote:
>
> Once the data have been inserted into the db, the id of the inserted
> record is stored in form.vars.id, which is a DAL Reference object.
> Assuming you don't want that value, just add a condition tes
Demo service:
https://tests.web2py.com/evote/default/index
Source:
https://github.com/mdipierro/evote
I could use some help checking it. Specifically usability and security.
Massimo
--
How did you populate the Star field?
On Wednesday, 8 August 2012 21:39:42 UTC-5, Mike Girard wrote:
>
> Hello:
>
> I am building a movie database site with web2py. I have a movies table
> which has a many-to-many relationship with several other items: stars,
> directors and genres. I am using a
can you please open a ticket?
On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
>
> Ok. I've managed to connect to MySQL from GAE local dev server on Windows
> if I change line 3845 in dal.py to this:
>
> self.folder = ""
>
> instead of (self.folder = folder or
> '$HOME/'+thre
Can you please open a ticket?
On Wednesday, 8 August 2012 12:08:53 UTC-5, Mandar Vaze wrote:
>
> I'm using web2py version : Version 2.0.0 (2012-07-26 06:06:10) dev
>
> I have tables defined as follows :
>
> name = db.Table(db, 'name',
>
>
if db(db.state.id>0).count() == 0:
db.state.truncate()
db.city.truncate()
db.zipcode.truncate()
db.areacode.truncate()
db.state.insert(name='Texas')
db.state.insert(name='Illinois')
db.state.insert(name='California')
db.city.insert(name='Austin',state=1)
db.city
You could monkey patch it in 0.py in models, perhaps.
On Thursday, July 26, 2012 1:10:43 AM UTC-7, Omri Har-Shemesh wrote:
>
> I use the pickled field to store a dictionary. Since dictionary
> is not defined as a serializable type for the as_dict function,
> it is not returned when calling to as_d
Hi all
How do I store the DB connection information (db = DAL(...)) in the
private/ folder?
I would like to sync the application using Mercurial. The local DB
information should not be shared.
The .hgignore file already includes "private/*".
Cheers
-Luca.
--
Hi Derek,
thanks! the as_dict method has already been fixed in trunk to handle
my use-case.
best wishes,
Omri
On Sat, Aug 11, 2012 at 12:26 AM, Derek wrote:
> You could monkey patch it in 0.py in models, perhaps.
>
>
> On Thursday, July 26, 2012 1:10:43 AM UTC-7, Omri Har-Shemesh wrote:
>
>> I
aww, I love to see a cute monkey patch.
On Friday, August 10, 2012 3:28:03 PM UTC-7, Omri Har-Shemesh wrote:
>
> Hi Derek,
>
> thanks! the as_dict method has already been fixed in trunk to handle
> my use-case.
>
> best wishes,
> Omri
>
> On Sat, Aug 11, 2012 at 12:26 AM, Derek >wrote:
>
>> You co
Hi,
I want to give the user the option to perform a batch upload of their image
files and/or video files.
How should I go about that in web2py?
Must video and image uploads be performed separately?
Thanks!
--
http://blueimp.github.com/jQuery-File-Upload/
--
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.fileuploader.w2p
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.upload.w2p
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advance
for me that works
alist = db(db.auth_user).select().as_list()
--
That definitely looks like a problem. Still though, I think you are taking
3NF a bit too far, no?
On Wednesday, August 8, 2012 10:08:53 AM UTC-7, Mandar Vaze wrote:
>
> I'm using web2py version : Version 2.0.0 (2012-07-26 06:06:10) dev
>
> I have tables defined as follows :
>
> name = db.Table(d
works for me too.
db(db.customers).select(db.customers.name).as_list()
On Friday, August 10, 2012 3:58:08 PM UTC-7, Vasile Ermicioi wrote:
>
> for me that works
>
> alist = db(db.auth_user).select().as_list()
>
--
On the demo, after creating an election I was redirected to the home page
rather than to the index. I would think the index would make more sense,
since that is where you find the create button.
This is a cool idea, though.
On Friday, August 10, 2012 5:24:10 PM UTC-4, Massimo Di Pierro wrote:
Unfortunately I was unable to get login with LinkedIn working.
Here are my troubleshooting steps:
https://groups.google.com/forum/#!topic/web2py/SbnQEnXEcOg
Any ideas on how I can get login with LinkedIn working?
Thanks for all suggestions,
Alec Taylor
--
Hi Bruno,
I am not creating, I am trying to update...
The example record:
*A simple entry:*
*estadio.cod_estadio* *estadio.nome_estadio* *estadio.cidade**1**A Definir**A
Definir*
On Fri, Aug 10, 2012 at 3:25 PM, Bruno Rocha wrote:
> Dirk posted this on web2pyslices...
>
> To PUT (=update) som
I use Anthony's method because it returns a true list.
as_list() returns a list of dictionaries, and you still have to iterate
over the dictionaries in the list to extract the values.
On Friday, August 10, 2012 4:34:01 PM UTC-4, Toby Shepard wrote:
>
>
> I'm in a situation where I just want a si
Is there a way to update all computed fields via appadmin's db interface?
On Saturday, July 28, 2012 2:45:28 PM UTC-7, Massimo Di Pierro wrote:
>
> It depends. If it is computed based on other fields, you should do an
> update of those fields. Else you can update it by expliticly calling the
On Friday, August 10, 2012 6:58:08 PM UTC-4, Vasile Ermicioi wrote:
>
> for me that works
>
> alist = db(db.auth_user).select().as_list()
>
That returns a list of dictionaries, like [{'myfield': 'value 1'},
{'myfield': 'value 2}]. I assumed he was looking for a list of the
individual field value
Yes but replace
if db(db.state.id>0).count() == 0:
with
if cache.ram('init',lambda:db(db.state.id>0).count(),None) == 0:
So that is executed once and then cached forever.
On Friday, 10 August 2012 16:57:45 UTC-5, Richard wrote:
>
> if db(db.state.id>0).count() == 0:
> db.state.truncate(
On Friday, August 10, 2012 5:57:45 PM UTC-4, Richard wrote:
>
> if db(db.state.id>0).count() == 0:
>
>
FYI, now you can do:
if db(db.mytable).isempty():
Note, db(db.mytable) is equivalent to db(db.mytable.id > 0).
Anthony
--
you stil want to cache that
if cache.ram('init',lambda:db(db.mytable).isempty(),None):
On Friday, 10 August 2012 21:42:09 UTC-5, Anthony wrote:
>
> On Friday, August 10, 2012 5:57:45 PM UTC-4, Richard wrote:
>>
>> if db(db.state.id>0).count() == 0:
>>
>>
> FYI, now you can do:
>
> if db(db.mytabl
67 matches
Mail list logo