hi, not to waste time, plz tell me how should i use this code in controller
default.py :
it works in python well but in web2py error..error..error
from urllib2 import Request, urlopen, URLError
url = request.vars.url
req = Request(url)
try:
response = urlopen(req)
except
I would like to perform REST Services by mapping url to the
controller-function. For eg:
@app.route('/')def api_root():
return 'Welcome'
@app.route('/articles')def api_articles():
return 'List of ' + url_for('api_articles')
@app.route('/articles/articleid')def api_article(articleid):
Hi,
I am looking for a way to automatically find any possible duplicate records
(rows) in one table of my Postgres database.
Quick google-ing reveals it is easy to do it with pure SQL, e.g. one way
specific for Postgres:
Duplicate of http://code.google.com/p/web2py/issues/detail?id=648
The error goes away if unique=True is removed.
-Mandar
On Thursday, August 9, 2012 9:13:36 PM UTC+5:30, Mandar Vaze wrote:
I figured out that problem is due to the way I have defined Table
Inheritance for mother/father/child.
Duplicate of http://code.google.com/p/web2py/issues/detail?id=648
The error goes away if unique=True is removed.
-Mandar
On Monday, August 13, 2012 1:02:55 PM UTC+5:30, Mandar Vaze wrote:
Done.
http://code.google.com/p/web2py/issues/detail?id=931
-Mandar
On Saturday, August 11, 2012
I've added a new table to my existing postgres db but it's not getting
created. My DAL and table settings are as follows:
db = DAL(
'postgres://...my_credentials...',
pool_size=20,
migrate_enabled=True,
fake_migrate=True,
)
db.define_table(
'migrate_queue',
Ah, heck. I decided to rename the table and got it to work. I'm wondering
... I have a function under models where it says def migrate_queue(): I'm
wondering if this creates a conflict and causes the system to not create
the desired table?
--
Bother again! There is another table that's not getting created, so this is
still an issue.
--
Having used Udi's additions to Web2py to get basic authentication using
LinkedIn working I'd like to interact with the LinkedIn API.
I can get to this functonality using linkedin.py (by Ozgur Vatansever) in a
controller using auth.settings.login_form.session.linkedin
e.g.,
I plan to do one, but you simply provide a json or csv service / URL with
web2py, and then use it in a view with the d3 JavaScript code. D3 takes some
learning, and I still have a long way to go.
--
HI all
who can give source Web2Py Electronic Health Record
--
I for one couldn't get the session variable to work properly, and
received an error (see:
https://groups.google.com/forum/#!topic/web2py/D7hwgsbBemk)
On Thu, Aug 16, 2012 at 8:38 PM, Carl m...@carlroach.com wrote:
Having used Udi's additions to Web2py to get basic authentication using
LinkedIn
I haven't integrated this LinkedIn with GAE just yet. I'll see if I get the
same exception when I do.
On 16 Aug 2012, at 11:45, Alec Taylor alec.tayl...@gmail.com wrote:
I for one couldn't get the session variable to work properly, and
received an error (see:
Then you got a real note resting exception:
type 'exceptions.ImportError' No module named google.appengine.api
I didn't get this. I'm using latest Web2py.
On 16 Aug 2012, at 11:51, Alec Taylor alec.tayl...@gmail.com wrote:
I'm not using GAE, I've tried to get it working on the Rocket server
Hello,
I know this list is by web2py and I am a regular user of the framework
to generate valuable content, however, when it comes to EMR, we refer
to an entire complex system that must be related to imaging,
laboratory and administrative systems even that HL7 or Mirth without
mentioning ... That
I'm running almost the latest trunk, # 4e02406b61c9de725a0b73ae9b73b71f4b1c2413
(from 16 hours ago)
And have been getting this error.
Maybe I've misordered things... here is my db.py: http://pastebin.com/1gE50Rnn
(my controller is the same as in the web2pyslice page)
On Thu, Aug 16, 2012 at
The log shows that the table that's not getting created was created but
with the comment faked! after it. Postgres inspection shows table not
created.
On Thursday, August 16, 2012 7:07:15 PM UTC+8, Niphlod wrote:
just open sql.log in the databases folder and see what is going on
On
and this is fine because you have fake_migrate=True, so, what do you want ?
On Thursday, August 16, 2012 1:55:31 PM UTC+2, weheh wrote:
The log shows that the table that's not getting created was created but
with the comment faked! after it. Postgres inspection shows table not
created.
I've an associate table for many-to-many relationship with composite
key defined as follows :
db.define_table('user_skill',
Field('user', db.user),
Field('skill', db.skill),
primarykey=['user', 'skill'])
When I use SQLFORM.grid for the above table, I get the following error :
Please can someone explain why, for a list of fields, that
fields.index(anything at all) always evaluates to 0.
For example this prints 23 and 0.
t=db.todo
fields = [t.id, t.customer, t.subject, t.completed, t.modified_by]
if 23 in fields: print(23 is in there)
print(fields.index(hshshshs))
Yarrr!
So, I'm using the smartgrid beta and noticed that some parts of it are not
I18N. Should I fix it and send a patch or you guys are working on it
already?
Thanks
--
That would be great. Or simply list the parts not internationalized
--
Nah, I'll do it, the community is so supportive and its make me on the mood
to contribute (:
I'll just will need some help to send you a patch, never did it on github
On Thu, Aug 16, 2012 at 10:53 AM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
That would be great. Or simply list the
Massimo:
Thanks...
I did more testing this morning,
1- set up 3 voters, one with email ending in .on.ca, and I didn't get that
one, maybe it is our server, I checked JUNK email, nothing
2- the other 2 emails worked, got email, got voting confirmation, BUT..
confirmation shows I definetly
OK, the following may be my own mistake (I changed a normal table to the
one with composite key without changing rest of the code)
Now, next question : via appadmin, how can I edit a record from a table
with contains the composite key ?
Normally, user would click on id shown in the table which
Try with this version. I need to warning you the python regex are different
of javascript regex, so it could be problematic depending of the regex that
you use.
El miércoles, 15 de agosto de 2012 00:37:35 UTC-3, Alec Taylor escribió:
Thanks a heap Franco :)
The only suggestion I have is to
Thanks :)
On Fri, Aug 17, 2012 at 1:15 AM, Franco franco.alar...@gmail.com wrote:
Try with this version. I need to warning you the python regex are
different of javascript regex, so it could be problematic depending of the
regex that you use.
El miércoles, 15 de agosto de 2012 00:37:35
Is ExtendedLoginForm intended to be used by OAuth implementations such as
LinkedInAccount?
Or only for authentications that use a HTML form to prompt the user for
credentials?
--
Dear web2py Book Team,
In chapter/29/7#SQLFORM where it is explaining the arguments of the SQLFORM
function, the *buttons *argument doesn't have its name in front of its
explanation.
Love and peace
--
Nothing changes if fake_migrate=False and db.define_table('mytable', ...
migrate=True). What I want is 'mytable' to be built, which it isn't.
On Thursday, August 16, 2012 7:58:44 PM UTC+8, Niphlod wrote:
and this is fine because you have fake_migrate=True, so, what do you want ?
On Thursday,
Cannot reproduce:
a=[1,2,3]
a.index(0)
Traceback (most recent call last):
File stdin, line 1, in module
ValueError: 0 is not in list
On Thursday, 16 August 2012 08:31:51 UTC-5, simon wrote:
Please can someone explain why, for a list of fields, that
fields.index(anything at all) always
On a second thought
probably the index method compares with == and not is. as in
def index(list,value):
for k,vin enumerate(list):
if v==value: return k
raise ValueError, %s is not in list % value
while it should do
def index(list,value):
for k,vin
You can use github but mind github does not send notification and sometime
they wait there for longer then they should.
I always apply patches manually because I have to manage both git and hg.
If you email me the patch (or a diff) or post it in a google code issue it
is even better for me.
Strange problem. I have not seen it before. I will double check it.
The editor is cleditor. I never used it before but looked simple enough. In
particular the plugins are very easy to make compared to other editors. I
also like that it supports tables.
Massimo
On Thursday, 16 August 2012
No SQLFORM.grid does not support keyed tables. Sorry.
On Thursday, 16 August 2012 07:23:15 UTC-5, Mandar Vaze wrote:
I've an associate table for many-to-many relationship with composite
key defined as follows :
db.define_table('user_skill',
Field('user', db.user),
Field objects inherit from the DAL Expression class, which overloads the
== operator, which produces a Query object rather than actually testing
for equality. So, when comparing the argument passed to index() against
Field objects in the list, you will never get a False. If the first item in
If you set fake_migrate=True you mean my table are there, do not create
them, but make the .table files. The .table files tell web2py that the
tables are in the database. If you then fake_migrate=False and
migrate=True, web2py checks the .table and decides the tables are there
(because you
That's odd -- it's in the markmin. Massimo, any idea what the problem is?
On Thursday, August 16, 2012 11:54:45 AM UTC-4, JoeCodeswell wrote:
Dear web2py Book Team,
In chapter/29/7#SQLFORM where it is explaining the arguments of the
SQLFORM function, the *buttons *argument doesn't have its
Are you talking about this: http://code.google.com/p/web2pyhl7/
Anthony
On Thursday, August 16, 2012 4:14:12 AM UTC-4, Ulugbek Nurjonov wrote:
HI all
who can give source Web2Py Electronic Health Record
--
Thanks, Massimo. I screwed up -- earlier on I had deleted the *.table file
for mytable but I must have not set fake_migrate to False. I just did it
again, making sure the fake_migrate=False, and it works. Life is good.
--
Hi guys,
I'm using
Version 2.00.0 (2012-08-07 22:45:43) dev
model
db.define_table('staff',
Field('user_id','reference auth_user',default=auth.user_id,writable=
False,readable=False),
Field('photo', 'upload', uploadfield='image_file'),
Field('image_file', 'blob')
)
controller
def
Did the two voted at times very close to each other...
Did you vote first for 1 or first for 3?
On Thursday, 16 August 2012 09:15:10 UTC-5, Rob_McC wrote:
Massimo:
Thanks...
I did more testing this morning,
1- set up 3 voters, one with email ending in .on.ca, and I didn't get
that
form = SQLFORM(db.staff,record)
should be
form = SQLFORM(db.staff,record,upload=URL('download'))
On Thursday, 16 August 2012 11:43:14 UTC-5, lyn2py wrote:
Hi guys,
I'm using
Version 2.00.0 (2012-08-07 22:45:43) dev
model
db.define_table('staff',
Field('user_id','reference
web2py does not use decorators to specify routes like Flask does (which can
get cumbersome and difficult to maintain with lots of routes). Instead,
first, you get default routing without making any explicit routing
specifications -- see the link I posted earlier:
you are right. I think this is now fixed on google code (not on github
because I am behind a firewall and cannot push to github right now).
Massimo
On Thursday, 16 August 2012 00:42:34 UTC-5, Anthony wrote:
Massimo, note that prettydate() does fail silently due to a try/except
(the except
I'm posting this question here as well as on
stackoverflowhttp://stackoverflow.com/questions/11991678/can-web2py-serve-rest-data-of-many-to-may-tables-via-parse-as-rest.
So hopefully the extra exposure will help me out!
I need to serve REST data about a many-to-many relationship. I've been
I would recommend Anthony's solution but you can do something similar like
this:
1) create a file routes.py with
# begin
routes_in = [
('/' , '/appname/default/api_root'),
('/articles' , '/appname/default/api_articles'),
('/article/(?Pid\d+)' ,
If you have any advice. :-)
I most certainly don't! I wish I had enough experience to really get in on
this conversation.
Your ajax solution seems pretty doable, but you're absolutely correct that
it would require javascript at all times.
For what it's worth, the suggestions from the flask
Thanks Massimo!
Although the [file|delete] overlaps with the browse button.
On Friday, August 17, 2012 1:05:48 AM UTC+8, Massimo Di Pierro wrote:
form = SQLFORM(db.staff,record)
should be
form = SQLFORM(db.staff,record,upload=URL('download'))
On Thursday, 16 August 2012 11:43:14 UTC-5,
I'v been fiddling with these ideas. They are very similar to the
flask/sqlalchemy solutions I've seen in my other queries. Thanks a ton for
the suggestions. This is a pretty nice community.
On Sunday, July 29, 2012 11:16:53 PM UTC-6, Anthony wrote:
- if you define your models carefully
Does this break backward compatibility, or do you consider this a bug?
Note, Pystar's problem is not that the function was failing silently, but
that his item.now value was a string when he expected it to be a datetime
object (i.e., now it will still fail, but not silently).
Anthony
On
Hopefully this is an easy one.
I'm using a pattern-based routes.py file. How can I enable
map_hyphens functionality? Do I have to come up with a regex for my
routes_in and routes_out, or is there a way to mix pattern-based and
parameter-based systems?
Thanks,
Neil
--
Massimo,
Sorry, for the late reply. I downloaded the latest Version 2.0.0
(2012-08-15 17:30:38) dev and confirmed it fixed now.
On Tuesday, August 7, 2012 5:01:56 PM UTC-5, Massimo Di Pierro wrote:
It is probably because of this line in gluon/main.py
if not
Thanks, that is helpful. But the path does not seem to be passed in the
custom retrieve.
Field('file','upload',
uploadir='/path/to/folder', custom_store=lambda
file,filename,path:store_file(file,filename,path),
custom_retrieve=retrieve_file
On Wednesday, August 8, 2012 6:51:44 AM UTC-5,
I'd rather stay in app code. If I do db.executesql(..., as_dict=True) could
I copy that into a Storage object to get something roughly similar to a DAL
object?
I started trying to build it in DAL and got part of the way. I was seeing a
problem with the counts where it wasn't executing multiple
To Max,
Like Anthony said, why is a datetime object I retrieved from my database in
a controller automatically converted to a string object? and how come
prettydate() cant convert datetime objects that are strings too? Is this a
feature of a bug? I also discovered that if i do this in my view
It shows the dropdown list when I define IS_IN_DB like this. (See OK)
But doesn't appear when I use the table with primary key (See NG)
OK
--
db.define_table('person',
Field('modified_on', 'datetime',
I would also like to know the format that the request.now value which is
equivalent to datetime.datetime.now() follow? i,e, If I was to convert a
string to a datetime object using the
datetime.datetime.strptime(datetimestring, [format]), I tried passing
%Y-%m-%d %h:%m:%f but I got a traceback
Can we see your model? Are you sure the timestamp field is a datetime
field and not a string field? When I try prettydate with a datetime field,
it works fine?
Anthony
On Thursday, August 16, 2012 3:26:24 PM UTC-4, Pystar wrote:
To Max,
Like Anthony said, why is a datetime object I
IS_IN_DB does not produce a dropdown when it is in a list, only when it
stands alone. If you want the dropdown and want to use additional
validators, use it's _and argument -- see
http://web2py.com/books/default/chapter/29/7#Database-validators.
Anthony
On Thursday, August 16, 2012 3:27:30 PM
On Thursday, August 16, 2012 3:07:12 PM UTC-4, pbreit wrote:
I'd rather stay in app code. If I do db.executesql(..., as_dict=True)
could I copy that into a Storage object to get something roughly similar to
a DAL object?
You might try something like this:
I goofed, A big apology to Anthony and Max. It works now, I actually didnt
define a FIELDTYPE in my db definition so I guess it just defaulted to
storing the field values as a string.
On Thursday, August 16, 2012 8:37:56 PM UTC+1, Anthony wrote:
Can we see your model? Are you sure the
So I have to define it in Controller like below ?
I just want to use dopdown list from another table just like person, dog
tables but why it's acting differently when I use primarykey ?
def index():
(...)
query = (db.table.field == 'xyz') #in practice 'xyz' would be a variable
Anthony,
Nevermind, I finally understand what you mean by IS_IN_DB does not produce
a dropdown when it is in a list
I changed like the following and it works !!
db.EDXHLF00.HLHSHH.requires=IS_IN_DB(db,db.TDMHLL00.HLHSHH)
On Thursday, August 16, 2012 2:42:03 PM UTC-5, Anthony wrote:
IS_IN_DB
Hi,
I have tried deploying an earlier version of my app on gae and was
successful, unfortunately the product release version of my app is
faltering when I try to run locally on gae before deploying and was getting
undefined error. In the process of debugging I made changes in my app.yaml
file
Be glad to test some more,
here are details from my previous test:
*Here are the TWO confirmation email I received.
* Times are noted, they were quite close
NOTE:
Will you have a TIME ZONE setting for the application?
Then, I would know, what time voted on based on my time zone...
Candidate
On Thursday, August 16, 2012 12:24:34 AM UTC-4, Matt wrote:
On Wed, Aug 15, 2012 at 10:03 PM, Anthony abasta...@gmail.com wrote:
Is there any way around this? This seems to have broken only with the
upgrade to Mountain Lion. We develop this app primarily on (and for)
linux,
however
On 16 Aug 2012, at 10:33 AM, Neil yager.n...@gmail.com wrote:
I'm using a pattern-based routes.py file. How can I enable map_hyphens
functionality? Do I have to come up with a regex for my routes_in and
routes_out,
yes
or is there a way to mix pattern-based and parameter-based systems?
no
You should not need to use local_import, which is deprecated. Regular
import should work, so there is a problem somewhere.
Anthony
On Thursday, August 16, 2012 4:52:54 PM UTC-4, Matt wrote:
On Thursday, August 16, 2012 12:24:34 AM UTC-4, Matt wrote:
On Wed, Aug 15, 2012 at 10:03 PM,
Do you still have all the __init__.py files (i.e., in /web2py,
/applications, /yourapp, and /yourapp/modules)?
On Thursday, August 16, 2012 5:29:30 PM UTC-4, Anthony wrote:
You should not need to use local_import, which is deprecated. Regular
import should work, so there is a problem
I have am menu with someting like
('stop_impersonating', ... is_impersonating()),...
This menu entry should only be activ when impersonating is activ.
Now I have tried a fresh installation of web2py and I got:
Traceback (most recent call last):
File /etc/web2py/gluon/restricted.py, line
I have a program with a menu and I tried Firefox and Google Chrome:
Chrom shows the menu, Firefox not.
Line 76 in layout.html is:
div class=nav-collapse
I could not find a definition for the class nav-collapse.
Next step: I removed this class definition
div !-- was:
Just what I was thinking about also. However it looks like the working
demo is now invalid.
On Thursday, August 16, 2012 9:34:44 AM UTC-7, Anthony wrote:
Are you talking about this: http://code.google.com/p/web2pyhl7/
Anthony
On Thursday, August 16, 2012 4:14:12 AM UTC-4, Ulugbek Nurjonov
You found a bug. It is now fixed. Can you please give it one more try?
massimo
On Thursday, 16 August 2012 15:49:20 UTC-5, Rob_McC wrote:
Be glad to test some more,
here are details from my previous test:
*Here are the TWO confirmation email I received.
* Times are noted, they were
Can you help us test this. If anything caused it, could be changeset:
3324:ef7523559742
--- a/gluon/custom_import.py Wed Jun 06 11:37:28 2012 -0500
+++ b/gluon/custom_import.py Thu Aug 16 18:18:23 2012 -0500
@@ -287,14 +287,14 @@
return super(_Web2pyImporter, self) \
Massimo:
*Can you please give it one more try?*
. But of course.
*But first, I wanted to say thanks for creating web2py, and supporting it,
it really is excellent just excellent...
*
*- - - - - - - - - - - - - - - - - - - - - - -
*Here is my Beta test report:
Name of Election:
Anthony:
. Thanks for submitting a patch.
*Quick Question:
With all of the below validations
*1- Do they ALL execute
or
2- Execution stops at the first one that fails,
What I mean is say a user uses a username=bill
the first validator will display the message, but does web2py continue to
*With all of the below validations
*1- Do they ALL execute
or
2- Execution stops at the first one that fails,
What I mean is say a user uses a username=bill
the first validator will display the message, but does web2py continue to
evaluate the others?
*If so..
* Wouldn't it
1) is actually a feature. All ballots are always public. Anonymous of
course. Perhaps they should only be public after the election is closed?
Massimo
On Thursday, 16 August 2012 19:35:36 UTC-5, Rob_McC wrote:
Massimo:
*Can you please give it one more try?*
. But of course.
*But first,
I down;oaded a file of web2py examples and I wanted to put carsales in my
web2py applications sso I could see how the application looks. I downloaded
the file that contained car sales and unzipped it .I thought I could unzip
it into my folder projects where I could have my applications.I
I think all the three issues have been addressed. About 1). Now only the
voter, the managers (who get copy of the receipt) can see the receipt
before the election is closed. After they become public.
The managers can get see the receipt. The officer who creates the election
can see the results
You should use admin to install applications. If you want to do it manually
you need do
cd applications
mkdir appname
cd appname
tar zxvf /path/to/web2py.app.carsales.w2p
at voila'? The w2p files do not contain the parent folder because, to avoid
conflict, they want you to name the app.
On
BTW... it is a very simple example written by a student.
On Thursday, 16 August 2012 21:11:01 UTC-5, Massimo Di Pierro wrote:
You should use admin to install applications. If you want to do it
manually you need do
cd applications
mkdir appname
cd appname
tar zxvf
auth.settings.register_onaccept.append(lambda form:\
mail.send(to='y...@example.com',subject='new user',
message='new user email is %s'%form.vars.email))
Above causes a ticket saying:
auth.settings.verify_email_onaccept(lambda form:\
TypeError: 'list' object is not callable
Hello,
What is the recommended place in web2py folder where I should store custom
functions that are useful to multiple applications? For example, suppose I
have a function such as the following:
*def connecttodb():*
*if request.is_local:*
*user=user*
*passwd=passed*
*
I have written one sql query:
select device_id, sensor_id, max(created_on) from test.abc_tbl where
date_sub(now(), interval interval_time minute) created_on group by
device_id, sensor_id;
How to write it in web2py?
Please help me to do the same.
Thanks.
--
I guess site-packages:
http://web2py.com/books/default/chapter/29/4?search=site-packages
But why oh why aren't you using DAL?
--
Anthony and Massimo, I'd really thank you ppl for giving me a solution with
some code! Thats wonderful!.
It really helped me get going. Thanks again guys. :)
Deepak
On Thursday, 16 August 2012 22:37:41 UTC+5:30, Anthony wrote:
web2py does not use decorators to specify routes like Flask
Hello pbreit,
Thanks, I will look into that. After posting I realized, I have the same
question for css style files and js files. Where can I store those? Can I
just store them in one application, and call them using URL() function? Is
that the best way, or is there something better?
I am new
I just want to know how to create URL pattern in routes.py, what i really
want to understand is, how to parse parameters in URL patterns like the
one, Massimo showed in his example --
*('/article/(?Pid\d+)' , '/appname/default/article/$id')*
*(?Pid\d+) *
*
*
I would be really helpful if I
Using the pattern-based system, you have two options (which can be mixed)
-- Python regular expressions as well as an alternative simpler syntax,
both described here:
http://web2py.com/books/default/chapter/29/4#Pattern-based-system. There
are many additional resources on the internet for
i personally have not used parse_as_rest so i might be out in left field
here.but are you able to access the output of the query and update it
before it is returned?
or perhaps even better, add a format parameter to the table definitions so
that you can format the display of references (to
we can't tell what the problem is from the pasted code (aside from
indentation that was probably messed up in copy/paste).
can you show us an example of your default.py file and the traceback you
are getting with the error?
On Thursday, August 16, 2012 12:29:25 AM UTC-7, Hojat Taheri wrote:
Is that code inside a function, or just at the top level in the controller?
You probably want it in a function.
How does request.vars.url get set? Note, if there is no url GET or POST
variable, request.vars.url will be None, and Request(url) will raise an
exception.
Anthony
On Thursday,
I put my applications in c:/python27/projects
i make my application = cars
I change my directory to cars
I run some program tar zxvf/\/c:/web2py/applications/web2py.app.carsale.w2p
i am running Vista
what should tar zxvf be in Vista?
I think web2py is good for learning web in python!
I
95 matches
Mail list logo