[web2py] Re: [py4web] - how to disable some auth actions?

2020-03-29 Thread Limedrop
+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

[web2py] Custom Delimiters Broken in 2.18.1?

2019-02-24 Thread Limedrop
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

[web2py] Re: does field object know it's tablename?

2016-11-21 Thread Limedrop
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

[web2py] Re: How to check if new password is different from the actual?

2016-06-27 Thread Limedrop
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,

[web2py] Re: generic.docx ?

2016-06-15 Thread Limedrop
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

[web2py] Re: update_or_insert

2016-05-02 Thread Limedrop
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

Re: [web2py] Re: When will we have a proper forum ?

2015-08-06 Thread Limedrop
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

Re: [web2py] Re: When will we have a proper forum ?

2015-08-05 Thread Limedrop
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

[web2py] Re: Decoding file name.

2015-07-28 Thread Limedrop
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.

[web2py] Re: How do I check of the version of pysimplesoap in web2py.

2015-06-24 Thread Limedrop
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

[web2py] Re: Select multiple rows

2015-06-14 Thread Limedrop
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=

[web2py] Re: How to write dynamic part of a select?

2015-04-18 Thread Limedrop
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

[web2py] Re: How to write dynamic part of a select?

2015-04-14 Thread Limedrop
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

[web2py] Re: Design flaw in auth.impersonate ?

2015-04-05 Thread Limedrop
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

[web2py] Re: advice on creating multi purpose table

2015-01-19 Thread Limedrop
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'),

[web2py] Re: How to fix 'list' TypeError with many-to-many SQLFORM.factory and multiple=True?

2014-12-09 Thread Limedrop
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

[web2py] Re: Comments/notes and api documentation

2014-09-17 Thread Limedrop
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,

[web2py] Re: Strange ajax problem

2014-08-14 Thread Limedrop
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

[web2py] Re: scheduler new feature: task dependencies

2014-08-05 Thread Limedrop
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)

[web2py] Re: rname and reserved names

2014-07-21 Thread Limedrop
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

[web2py] Re: rname and reserved names

2014-07-20 Thread Limedrop
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:

[web2py] Re: rname and reserved names

2014-07-20 Thread Limedrop
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

Re: [web2py] Brainstorming

2014-06-22 Thread Limedrop
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

[web2py] Re: Download inside component

2014-06-13 Thread Limedrop
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:

[web2py] Re: get value of value attribute of input of SQLFORM

2014-06-11 Thread Limedrop
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:

Re: [web2py] Re: I'd like to know what is a suitable tool to generate document templates.

2014-03-26 Thread Limedrop
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

Re: [web2py] calling download function page by ajax

2014-03-18 Thread Limedrop
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}}

Re: [web2py] calling download function page by ajax

2014-03-18 Thread Limedrop
' 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

[web2py] Re: Force all requests to https - a pointer please

2014-02-27 Thread Limedrop
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

[web2py] Re: Detecting OS issue

2014-01-13 Thread Limedrop
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

Re: [web2py] Error uploading 60 character named .pptx file

2013-11-14 Thread Limedrop
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,

[web2py] Re: Scheduler TIMEOUT

2013-11-12 Thread Limedrop
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) -

[web2py] Re: Scheduler Namespace Gotcha

2013-08-25 Thread Limedrop
, 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

[web2py] Scheduler Namespace Gotcha

2013-08-09 Thread Limedrop
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

[web2py] Re: web2py Safety discussion

2013-06-04 Thread Limedrop
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

[web2py] Re: SQLFORM add a second custom submit button

2013-04-21 Thread Limedrop
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

[web2py] Re: need teaching advice (JS+jQuery)

2013-04-03 Thread Limedrop
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

[web2py] Re: Error when changing Postgresql password

2013-02-04 Thread Limedrop
(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

[web2py] Re: Can't store query in session

2012-09-06 Thread Limedrop
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

Re: [web2py] Re: SEO Friendly URLs and Page Titles

2012-08-27 Thread Limedrop
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

Re: [web2py] New version of bootstrap

2012-08-22 Thread Limedrop
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

[web2py] Re: LEFT JOIN query issues

2012-08-02 Thread Limedrop
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

[web2py] Re: Generating pdf using web2py-appreport (xhtmltopdf) in Python Web2py webapp

2012-07-09 Thread Limedrop
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

[web2py] Re: How to Save Query in Session

2012-03-29 Thread Limedrop
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

[web2py] Re: Storing class instances in sessions... or somewhere

2012-03-29 Thread Limedrop
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...

[web2py] Re: Storing class instances in sessions... or somewhere

2012-03-29 Thread Limedrop
: 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

[web2py] Re: How to Save Query in Session

2012-03-28 Thread Limedrop
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

Re: [web2py] Re: Single error message for radio group

2012-03-28 Thread Limedrop
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(

Re: [web2py] Re: Single error message for radio group

2012-03-28 Thread Limedrop
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

Re: [web2py] Re: Single error message for radio group

2012-03-28 Thread Limedrop
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.

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-26 Thread Limedrop
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

[web2py] How to Save Query in Session

2012-03-26 Thread Limedrop
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

[web2py] Re: How to Save Query in Session

2012-03-26 Thread Limedrop
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

[web2py] Re: Bug? The DAL gives different SQL when query is provided as string.

2012-03-25 Thread Limedrop
)(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

[web2py] Bug? The DAL gives different SQL when query is provided as string.

2012-03-24 Thread Limedrop
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 =

[web2py] Re: missing FROM-clause entry

2012-03-23 Thread Limedrop
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

[web2py] Re: missing FROM-clause entry

2012-03-23 Thread Limedrop
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,

[web2py] Re: missing FROM-clause entry

2012-03-23 Thread Limedrop
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

[web2py] missing FROM-clause entry

2012-03-22 Thread Limedrop
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

[web2py] Re: transfer auth_group data with the app

2011-11-22 Thread Limedrop
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')

[web2py] Re: lexical scanner

2011-11-09 Thread Limedrop
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

[web2py] Re: lexical scanner

2011-11-09 Thread Limedrop
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

[web2py] Re: SyntaxError: Set: no tables selected on select statement.

2011-11-07 Thread Limedrop
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

[web2py] Re: SyntaxError: Set: no tables selected on select statement.

2011-11-07 Thread Limedrop
: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

[web2py] Re: lexical scanner

2011-11-03 Thread Limedrop
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

[web2py] Re: lexical scanner

2011-11-01 Thread Limedrop
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

[web2py] Re: nyroModal

2011-11-01 Thread Limedrop
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

[web2py] Re: lexical scanner

2011-11-01 Thread Limedrop
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

[web2py] Re: lexical scanner

2011-11-01 Thread Limedrop
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