+1 on this request. For some apps this is a deal-breaker. For example, a
client who wants a secure place for their employees and doesn't want any
random registration requests.
FYI, other Auth requirements that I've been asked to implement to 'secure'
an app are:
- Lock account after x
Hi there,
I think the custom template delimiters are broken in 2.18.1. Here's my
test code and the exception I'm getting:
CONTROLLER
def index():
response.delimiters = ('')
return dict(message=T('Welcome!'))
VIEW - index.html
{{extend 'layout.html'}}
Note that each column
Yes, it does. You can access the tablename like this:
>>>db.auth_user.email._tablename
'auth_user'
On Monday, 21 November 2016 23:14:00 UTC+13, Jurgis Pralgauskis wrote:
>
> or should I pass tablename to function alongside?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book
The function you are looking for is CRYPT. You could but something like
this in an on_validation function:
if auth.user.password == CRYPT()(request.vars.new_password)[0]:
form.errors.new_password = 'Cannot re-use password'
On Friday, 24 June 2016 03:53:47 UTC+12,
If you want to produce *simple *documents that can be edited in MS Word, it
might be easier to use the RTF format, which is supported by web2py out of
the box:
http://www.web2py.com/books/default/chapter/29/10/services#PyRTF
BUT be warned...my experience with PyRTF is that, while it is easy to
It looks like update_or_insert() will always do two database hits and, as
you say, even then doesn't give you the id of the existing record. It goes
something like this (pseudo code for clarity):
record = db.table.select()
if record:
update_record()
else:
insert record()
So it's a
2015 18:12:00 UTC+12, Massimo Di Pierro wrote:
I very much agree with this. How do you propose we do it?
On Wednesday, 5 August 2015 17:37:19 UTC-5, Limedrop wrote:
I hesitate to comment on this as it's one of those topics were there's
not one obvious way to do it (obviously I'm not Dutch
I hesitate to comment on this as it's one of those topics were there's not
one obvious way to do it (obviously I'm not Dutch). Essentially, I think
google groups does an okay job and the benefits of any change are likely to
be outweighed by the heavy cost of that change.
Having said that, I've
You could try something like this:
(filename, fullfilename) =
db.tablename.uploadfield.retrieve(record.uploadfield, nameonly=True)
On Wednesday, 29 July 2015 01:05:58 UTC+12, Prasad Muley wrote:
Hi All,
file name gets store as *93f00342868f4085.73716c2e6c6f67.log *in db
field.
SOAP can really be a world of pain. I spent hours trying to connect to a
SOAP service and the best I could get was a 400 Bad Request. It turned
out that they were using wsHttpBinding - which seems to only be supported
by .NET clients. The work-around is to manually inject the WS-Security
Try something like this:
rows = db(db.cikmis_soru.id.belongs(ids)).select()
On Monday, 15 June 2015 07:13:02 UTC+12, xmarx wrote:
Hi.
I want to select a list of id from database.
ids=[12,145,69]
how can i do this? Is there any quick way of it?
for example:
query=
arguments'
thank you!
On Wednesday, 15 April 2015 00:52:53 UTC+2, Limedrop wrote:
You can do this by building a list of fields and then using the python
unpack operator. For example:
field_list = [db.auth_user.first_name]
if ask_for_lastname:
field_list.append
You can do this by building a list of fields and then using the python
unpack operator. For example:
field_list = [db.auth_user.first_name]
if ask_for_lastname:
field_list.append(db.auth_user.last_name)
rows = db(query).select(*field_list)
See
Well the easy answer is to simply open the impersonated user in a different
browser (eg, have Support Team login in chrome and impersonated user login
in firefox).
For us it is important that impersonate is restricted to the user's
permissions...we have several classes of user and it is
Hi Leonel,
I like your suggestion, but I always wonder with these sorts of solutions
whether or not you need a separate field in the person_meta table for each
data type? For example:
db.define_table('person_meta',
Field('person', 'reference person'),
Field('name'),
Hi there,
The issue you have is that you are mixing a fully normalized solution and
the web2py short-cut.
In the table you have defined db.component_package_association.component_id
as a single integer, but the validator is giving the field multiple values.
The easy option is to delete the
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,
You might want to check out the javascript that Leonel submitted here:
https://groups.google.com/d/msg/web2py/JFy3BCHXgYc/7npKiqs6BOUJ
In particular see how he uses:
$.web2py.disableElement(form.find($.web2py.formInputClickSelector));
On Friday, August 15, 2014 8:20:05 AM UTC+12, Michael
Thanks Niphlop, that's brilliant! I've been using a work-around to
schedule dependent jobs, and this will help to tidy things up.
On Tuesday, August 5, 2014 8:51:25 PM UTC+12, Niphlod wrote:
Hi @all,
we have another feature in trunk for the scheduler... Jobs (i.e. task
dependencies)
This worked for me on postgresql 9.1...
db = DAL('%s%s' % (dal_connection, app_database))
rname = db._adapter.__class__.QUOTE_TEMPLATE % 'ALL'
db.define_table('test', Field('whatever', rname=rname))
Note that I used ALL rather than position as position is not a reserved
word on postgresql
The error message suggests that it is the field name (ie, position) that
is reserved.
On Monday, July 21, 2014 4:19:39 PM UTC+12, Simon Ashley wrote:
Haven't used rname before but the way I read it it should work with
reserved names. Have changed a given example to read:
I think you just need to turn the warning off.
db = DAL(..., check_reserved=None)
On Monday, July 21, 2014 5:05:06 PM UTC+12, Simon Ashley wrote:
Yep, agree with that but to quote Niphlod
*For the ones in need of:*
*- accessing legacy tables with some funny names *
*- use reserved
Have you looked at breezejs? A JavaScript library that helps you manage
data in rich client applications.
Breeze dynamically builds a mirror of the server-side db model on the
client and then binds to UI controls so the UI updates when the data model
changes. Each object knows when it has
I use that jquery plugin and it is very good. Note that you need to set
cookies within the download function, something like this...
response.cookies['fileDownload'] = 'true'
response.cookies['fileDownload']['path'] = /
On Saturday, June 14, 2014 3:40:01 AM UTC+12, Anthony wrote:
A more robust way to do this is to use the element search helper. Use the
id (or whatever) to find the INPUT like this:
element = form.element(_id='table_field')
and then the value will be:
element['_value']
See the book for all the other cool things you can do:
If your customer is happy using MS Word why force them to change? Word
files are just zipped up xml that can be manipulated using tools such as
lxml.etree. We let our customers upload Word templates that we then
populate with data and return to them as docx. That way they can use Word
to
You might want to look at
http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/
The only fiddly bit is to make sure you set the cookies correctly (see the
documentation for details).
For example:
{{view}}
'
response.cookies['fileDownload']['path'] = /
On Wednesday, March 19, 2014 6:18:11 PM UTC+13, Limedrop wrote:
You might want to look at
http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/
The only fiddly bit is to make sure you set the cookies
Try this:
session.secure()
if not request.is_https:
redirect('https://%s/%s' % (request.env.http_host,
request.application))
On Friday, February 28, 2014 11:46:20 AM UTC+13, Cliff Kachinske wrote:
I know I have read it somewhere, but I can't find it.
Where can I find out
Have a look at python's platform module. For example:
import platform
if platform.system() == 'Windows':
elif platform.system() == 'Linux':
On Tuesday, January 14, 2014 7:26:09 AM UTC+13, Jon Smith wrote:
Hello I am trying to figure out how to detect if a
Actually, the web2py setting you're looking for is 'length'. Here's an
example:
db.define_table('document',
Field('document_filename', writable=False, compute = lambda row:
request.post_vars.document.filename),
Field('document','upload',autodelete=True,
I've had this problem too. I think it would be good if the scheduler had
the option to retry timeouts, in the same way that retry_failed works.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
, they may got overwritten, causing problems. I sent a PR on
github to fix the issue.
On Saturday, August 10, 2013 12:03:10 AM UTC+2, Limedrop wrote:
Hi,
I was experiencing some strange results with the scheduler in one
particular application. Tasks would successfully execute
Hi,
I was experiencing some strange results with the scheduler in one
particular application. Tasks would successfully execute, but the
scheduler_task and scheduler_run records would stick on RUNNING.
After some hair pulling I discovered that the app model was using this
variable:
COMPLETED
I have often wondered if changing the names admin and appadmin would be
an easy and simple way to add another layer of security? In other words,
add these as command-line arguments that can be set on startup? In this
way www.mysite.com/admin could be changed to something like
Ideally something like this will work for you...
def test_form():
form = SQLFORM(db.table,
buttons = [INPUT(_type='Submit', _name='submit1', _value='Submit1'),
INPUT(_type='Submit', _name='submit2',
_value='Submit2')])
if form.accepts(request):
if
What about the google maps jQuery plugin?
http://www.pittss.lv/jquery/gomap/solutions.php
On Thursday, April 4, 2013 6:47:15 AM UTC+13, Massimo Di Pierro wrote:
Tomorrow I am starting teach a new class. I did not create the class, it
was assigned to me. The class is for undergraduate
(a) Because when you changed the DAL connection string, web2py thinks it
might be a new database and tries to recreate the tables from scratch.
(b) You could try:
db = DAL(...,fake_migrate_all=True)
run the app and, if successful, then:
db = DAL(...,fake_migrate_all=False)
But read the
Johann, you should look at this slice...
http://www.web2pyslices.com/slice/show/1489/save-query-in-session
Does it do what you want?
On Friday, September 7, 2012 12:40:44 AM UTC+12, Massimo Di Pierro wrote:
You cannot store a query in a session.
On Thursday, 6 September 2012 04:26:57
I don't know if you picked this up, but you don't seem to have row.id as
part of the sqlfrom url.
Perhaps try:
links = [lambda row: A('Details',_href=URL('default','equipment',
args=[row.id, row.slug]))]
On Tuesday, August 28, 2012 10:28:39 AM UTC+12, SeamusSeamus wrote:
Okay, but do
Bootstrap would now seem to provide sufficient support for web2py menus:
- Submenu support on dropdowns.
- Disabled states on navs and dropdowns.
And the Affix JavaScript plugin is cool.
On Wednesday, August 22, 2012 11:27:03 PM UTC+12, Khalil KHAMLICHI wrote:
Awesome!
On Wed, Aug 22, 2012
This gets me every now and then...
In python it should be == rather than =
left=db.mr_link.on(db.mr_link.recipID==db.recipient.id))
On Friday, August 3, 2012 8:08:38 AM UTC+12, Larry Wapnitsky wrote:
I'm trying to take the following MySQL query
SELECT recipient.emailAddress
FROM
Hi Akash,
Your example controller code seems good and shouldwork. The issue is that
PISA is a bit sensitive and only supports a reduced subset of CSS. The
error suggests PISA does not know how to handle Alpha(Opacity=0). You
will need to somehow strip out the unsupported CSS from the html
have a proposal to imporve the dal to make this easier.
On Wednesday, 28 March 2012 17:29:49 UTC-5, Limedrop wrote:
Sometimes that will be sufficient. The issue is how you turn _lastsql
into a gluon.dal object that you can further manipulate.
For example, what if you want to do
If instances are pickable then you should be okay. Have you tried saving
them to the session and seeing what happens? Note that sometimes you can
pickle things okay but the unpickle throws the error.
Failing that have a look at the recipe near the bottom of this thread...
:
On Friday, 30 March 2012 12:04:05 UTC+11, Limedrop wrote:
If instances are pickable then you should be okay. Have you tried saving
them to the session and seeing what happens? Note that sometimes you can
pickle things okay but the unpickle throws the error.
Have you tried saving them
Sometimes that will be sufficient. The issue is how you turn _lastsql into
a gluon.dal object that you can further manipulate.
For example, what if you want to do this:
_lastsql (db.person.name == 'John')
See the slice if you need to know how to do it.
On Thursday, March 29, 2012
I've got the same issue (running 1.99.7). Has anyone solved this?
On Sunday, February 26, 2012 6:12:41 PM UTC+13, Detectedstealth wrote:
Hi Massimo,
Your suggestion doesn't seem to be working:
LI(
H5(self.T('What is your Age?')),
INPUT(
Yes, tested and it now works! Thanks Massimo.
On Thursday, March 29, 2012 3:01:41 PM UTC+13, Massimo Di Pierro wrote:
I think there is a bug and I think I just fixed it in trunk. Please check
it.
On Wednesday, 28 March 2012 20:38:08 UTC-5, Limedrop wrote:
I've got the same issue (running
Thanks. In my case default=None (and needs to be), so thankfully Massimo's
fix does the trick.
On Thursday, March 29, 2012 3:27:40 PM UTC+13, Detectedstealth wrote:
The solution I made was setting a default value for all my radio groups.
giorno lunedì 26 marzo 2012 01:58:31 UTC+2, Limedrop ha scritto:
The difference is in the FROM clause. In the second SQL the webpage
table is missing.
On Mar 26, 12:51 pm, Niphlod niph...@gmail.com wrote:
is that because of the extra () ?
every time you call db() the where clause
Just in case any of you want to do this...I've written a routine that
enables you to save a Query/Expression object in the session.
I have a controller that uses a form to build a relatively complex
query and I want other controllers to use that query to generate
reports and graphs. I initially
Huh? I'm sorry but I don't understand.
On Mar 27, 4:28 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
you cannot.
On Monday, 26 March 2012 21:09:49 UTC-5, Limedrop wrote:
Just in case any of you want to do this...I've written a routine that
enables you to save a Query
)(db.auth_user.email==localhost)
and
db((db.auth_user.id0) (db.auth_user.email==localhost))
give you different raw strings, but the same exact result.
Il giorno sabato 24 marzo 2012 21:49:58 UTC+1, Limedrop ha scritto:
I've copied this from the bottom of another thread.
The DAL gives
I've copied this from the bottom of another thread.
The DAL gives different SQL when a query is provided in string format.
Is this a bug, or should I not expect this to work?
See the example below, the first SQL works, the second SQL raises an
error.
from gluon.dal import Query
query =
Thanks for your suggestion...it pointed me in the right direction.
It turns out the issue is not with the query construction, but that
DAL handles string input differently to objects. What I am trying to
do is take a Query and then convert it to a string so it can be saved
in the session. The
Thanks for the information. Unfortunately, in my case I really do
need to store the raw query in the session...and then convert it back
to a Query so I can then add a few more filters before the final
select(). Has anyone managed to store a representation of a query in
the session?
On Mar 24,
the DAL gives different results
for query1 and query2. Is this, then a bug?
On Mar 24, 3:28 pm, nick name i.like.privacy@gmail.com wrote:
On Friday, March 23, 2012 10:09:07 PM UTC-4, Limedrop wrote:
Thanks for the information. Unfortunately, in my case I really do
need to store
Running Web2py 1.99.7 and using a model based on the wiki in the book
(http://web2py.com/books/default/chapter/29/3#A-wiki). I want to
report a unique list of comments for a particular webpage, for a
particular tag (I've added a many-to-many tag table). I use a form to
build a query, which ends
Massimo's solution sure is cunning, but you might something like this
a bit more maintainable:
def install():
if db(db.auth_group.id 0).count() == 0:
db.auth_group.insert(role = 'edit')
db.auth_group.insert(role = 'moderate')
db.auth_group.insert(role = 'comment')
Sorry lucas, but I don't understand what you're trying to do. Can you
explain further?
On Nov 9, 4:53 pm, lucas sjluk...@gmail.com wrote:
ok, i have done so much using this really really cool technique.
anyway, how do i pass a function reference to a global storage
context so that the
Okay, in that caseyou pass the function to the view as you would
any other variable. For example:
return dict(form=form, rows=rows, file_lookup=file_lookup)
On Nov 10, 4:57 pm, lucas sjluk...@gmail.com wrote:
yes, i wrote a function in main.py which is an added controller in my
A couple of obvious thing. First, the query goes with the db() not
the select(). Second, the reference to room is via room.id rather
than room.name. So you could try:
reservations = db(db.reservation.room==room.id).select()
On Nov 8, 8:49 am, Matthew Young mab...@gmail.com wrote:
Hello I am
:39 pm, Limedrop russ...@holtrd.com wrote:
A couple of obvious thing. First, the query goes with the db() not
the select(). Second, the reference to room is via room.id rather
than room.name. So you could try:
reservations = db(db.reservation.room==room.id).select()
On Nov 8, 8:49
if you use the web2py Storage class:
context = Storage()
context.auth = auth
render(content=content, context=context)
or in raw python:
context = {}
context['auth'] = auth
render(content=content, context=context)
On Nov 3, 8:43 pm, lucas sjluk...@gmail.com wrote:
ok, something more
I think you want render. For example:
from gluon.template import render
fields=Storage()
fields.first_name = John
content = Hello {{=first_name}}
rendered = render(content, context=fields)
On Nov 2, 9:02 am, lucas sjluk...@gmail.com wrote:
ok, still stuck,
i played with CODE(...) but that
This is what I do:
if form.accepts(request.vars, session):
return_script = ['parent.$.nyroModalRemove();']
return_script.append('parent.window.location.reload();')
return HTML(BODY(SCRIPT(''.join(return_script.xml()
On Nov 1, 8:19 pm, Kenneth Lundström
Render is the same function used to process the views. So, as long as
you put all the variables in the namespace, your code will execute.
Something like this should work:
from gluon.template import render
context = Storage()
context.rows = rows
content =
HTML
p
{{
for row in rows:
..something
Conceptually, this is the same as giving any module to access the
web2py helpers...you will need to make them available within the
namespace. I did a quick test:
content = {{from gluon.html import *}}{{=A('hello world')}}
render(content=content)
'ahello world/a'
So it works! Other things you
69 matches
Mail list logo