[web2py] Re: VARCHAR or NVARCHAR?

2015-04-15 Thread Paolo Valleri
mssql adapters are quite messy. MSSQL2Adapter is the adapter that uses 'nvarchar' as type, however it inherits from MSSQLAdapter, given that it doesn't have the features of MSSQL4Adapter. For backward compatibility I don't think MSSQL2Adapter will be never updated to inherits from MSSQL4Adapter.

[web2py] variables outside any function

2015-04-15 Thread Annet
In a controller I got functions that use the same variables. I want to assign a value to them outside any function: if request.args(0) == 'openinghours': rdrctUrl = URL('opening_hours') function_header = 'Opening hours' function_icon = 'fa-clock-o' table = db.cal_opening_hours elif

[web2py] Re: variables outside any function

2015-04-15 Thread Anthony
The views are executed in an environment that includes anything defined in models as well as whatever items are passed in the dictionary from the controller function. Other objects defined in the controller are not available in the view environment. So, you must pass items directly from the con

[web2py] Need advice/help with url rewrite: multiple domains, multiple apps, two apps per domain

2015-04-15 Thread Lisandro
I have multiple domains with multiple applications. I've gotten it to work using routes.py, with both approaches: parameter-based and pattern-based system. However, there's a couple of things that still I can't achieve. 1) Two applications per each domain In my case, each domain serves two appl

Re: [web2py] Application Arquitecture advices

2015-04-15 Thread Richard Vézina
Sébastien, Start by making something then when you will need performance you can work on it. I have 155 tables in my app and it is not the model that slow down things... It is more the number of records in these tables that matter so far... I mean, I should use SQLFORM.grid which use paging and lo

[web2py] Re: Bug in SQLFORM.factory bootstrap3 formstyles ?

2015-04-15 Thread Gary Cowell
It makes it end up looking like this when using a dropdown: Wide Dropdown On Monday, 13 April 2015 06:35:05 UTC+1, Gary Cowell wrote: > > Hi > > Running with: > > > 2.10.3-stable+timestamp.2015.04.02.21.42.07 > > (Running on Rocket 1.2.6, Python 2.7.5) > > > I

[web2py] Re: Issue with lookup foreign key / format statement in 2.10.3

2015-04-15 Thread wish7code
Thats's good news! Thanks for taking care! Cheers Toby Am Dienstag, 14. April 2015 23:29:48 UTC+2 schrieb Niphlod: > > being a bug, we need to ship a new web2py. it got fixed already. we're > waiting for Massimo to release a 2.10.4. > > On Tuesday, April 14, 2015 at 10:51:31 PM UTC+2, wish...@gm

[web2py] Re: Run linux ssh script

2015-04-15 Thread Gary Cowell
I might be inclined (have done, in fact) to use a python ssh implementation to do this, rather than using shell. paramiko would be one such module, 'spur' module is easier to use. Not using shell gives the python greater control over error handling and recovery, among other things. Of course,

[web2py] HTML helpers to build a bootstrap dropdown button?

2015-04-15 Thread Gary Cowell
Hello I use code such as this: status = 'Delete' buttonTitle='Delete' buttonURL='deleteStack' buttonClass='button btn btn-danger' buttonIcon='icon trash icon-trash glyphicon glyphicon-trash' button = A( SPAN(_class=buttonIcon) ,buttonTitle

[web2py] Re: Admin disabled because too many invalid login attempts

2015-04-15 Thread Massimo Di Pierro
In admin/models/access.py deny_file = os.path.join(request.folder, 'private', 'hosts.deny') allowed_number_of_attempts = 5 expiration_failed_logins = 3600 You can remove/edit the file private/hosts.deny, or increase the number of attempts On Friday, 10 April 2015 23:00:33 UTC-5, Shreyas Pand

[web2py] Re: Sequential ajax search problem

2015-04-15 Thread Massimo Di Pierro
I think you want to replace links = [A(a.title, _href=URL('next_select', args=[a.id, a.title])) for a in images] with links = [A(a.title, _href=URL('next_select', args=[a.id, a.title]),_target=;_top') for a in images] On Friday, 10 April 2015 23:00:39 UTC-5, P Page-McCaw wrote: > > I'm a b

Re: [web2py] Re: WEB2PY Certificate ?

2015-04-15 Thread Massimo Di Pierro
This is an excellent idea. On Friday, 10 April 2015 23:00:40 UTC-5, KPlusPlus wrote: > > Can we start the same initiative around the world for the educational > institutions , where the institution can be recognized by web2py ? > > > On Friday, April 10, 2015 at 10:41:56 AM UTC+3, Mariano Rein

[web2py] Re: Bug in SQLFORM.factory bootstrap3 formstyles ?

2015-04-15 Thread Massimo Di Pierro
Please open a ticket On Wednesday, 15 April 2015 08:18:16 UTC-5, Gary Cowell wrote: > > It makes it end up looking like this when using a dropdown: > > Wide Dropdown > > > > On Monday, 13 April 2015 06:35:05 UTC+1, Gary Cowell wrote: >> >> Hi >> >> Running with: >>

Re: [web2py] LOAD component inside component

2015-04-15 Thread Massimo Di Pierro
Never tried. My guess is that jQuery.web2py.trap_form is not called for the inner forms. If you call it manually using jQuery you can make it work. But I would not. I would figure out how to use ractive.js instead. On Monday, 13 April 2015 15:00:39 UTC-5, Richard wrote: > > Hello, > > I creat

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Massimo Di Pierro
The problem is that it is not web2py but the user code that access the record. Web2py does not know that the user has been removed from the DB. This cannot be solved without checking if the user is still there and it can cause performance issues. Suggestions? On Tuesday, 14 April 2015 11:29:37

[web2py] Re: Prepolulate datetime field internationalization problem

2015-04-15 Thread Massimo Di Pierro
One solution is: form.vars.from = IS_DATETIME()(request.now)[0] On Tuesday, 14 April 2015 17:39:01 UTC-5, Sebastián Tromer wrote: > > Hello everyone! > > I'm prepopulating a form made with the FORM helper. > In the form I have 2 INPUTs of type DATETIME: > > INPUT(_name='from', _class='datetime',

[web2py] Re: Beginners question about multiple applications

2015-04-15 Thread Massimo Di Pierro
On Tuesday, 14 April 2015 15:51:31 UTC-5, Peter Gibson wrote: > > I am a beginner with Web2py but am very impressed with what I have seen > and read so far. > > I have plans to use Web2py for a sizable web project. > > My project requires a wiki (the built in one will do just fine) and what I

[web2py] Re: VARCHAR or NVARCHAR?

2015-04-15 Thread Massimo Di Pierro
yes but be aware this will affect all the applications. not just this one. On Wednesday, 15 April 2015 02:43:48 UTC-5, Paolo Valleri wrote: > > mssql adapters are quite messy. > MSSQL2Adapter is the adapter that uses 'nvarchar' as type, however it > inherits from MSSQLAdapter, given that it doesn

[web2py] Re: Need advice/help with url rewrite: multiple domains, multiple apps, two apps per domain

2015-04-15 Thread Massimo Di Pierro
Did you look into multi tenancy in web2py? You can use routes to map the domain into applications but do not use it to map domains. Use multi tenancy to have different domains map into different slices of the database with their own permissions. On Wednesday, 15 April 2015 08:00:35 UTC-5, Lisan

[web2py] Re: VARCHAR or NVARCHAR?

2015-04-15 Thread Niphlod
I'm on top of this "issue" in these days, but in the end we will just have to create yet another adapter (maybe a mssql*u* , mssql3*u* and mssql4*u*). The problem is subtle, and goes pretty unnoticed. If - as I - you create an app with mssql: (or mssql3, or mssql4) which have "varchar" type the o

[web2py] Re: Prepolulate datetime field internationalization problem

2015-04-15 Thread Sebastián Tromer
That didn't work, but looking at the code of appadmin and gluon/validators.py I found a possible solution: form.vars.from = IS_DATETIME().formatter(request.now) this is working OK. Thanks Massimo! Am Mittwoch, 15. April 2015 10:44:00 UTC-3 schrieb Massimo Di Pierro: > > One solution is: > > fo

Re: [web2py] Re: Need advice/help with url rewrite: multiple domains, multiple apps, two apps per domain

2015-04-15 Thread Lisandro Rostagno
Thanks for your time Massimo. I didn't know about multi-tenancy in web2py, I've just read a little about that. However I think it's not what I need in this case (but I've just read about multi-tenancy). Let me give some additional details of my case regarding databases (I realised that I didn't me

Re: [web2py] LOAD component inside component

2015-04-15 Thread Richard Vézina
Yes I should give it a real try, though I found usage example scarce after tutorial... I need to improve my ractive skill :) Richard On Wed, Apr 15, 2015 at 9:36 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Never tried. My guess is that > > jQuery.web2py.trap_form is not called

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Leonel Câmara
I think we have to take the performance hit. Hopefully the database will be smart enough to keep the records for the users in cache so the slowdown won't be that big. Right now this is sort of a security issue: 1. Add @auth.requires_login() to the welcome index function. 2. Register and login, c

Re: [web2py] Re: Beginners question about multiple applications

2015-04-15 Thread Richard Vézina
Point 3... Copy models/menu.py from one app to the other... But it is a bad idea... Richard On Wed, Apr 15, 2015 at 9:48 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > > > On Tuesday, 14 April 2015 15:51:31 UTC-5, Peter Gibson wrote: >> >> I am a beginner with Web2py but am very i

[web2py] Use model without DAL

2015-04-15 Thread Alessio Varalta
Hi, i have to use the class model but not the connection with the database exist and method to take the model and insert the value without DAL? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/w

Re: [web2py] Application Arquitecture advices

2015-04-15 Thread Sébastien Loix
Thank you Richard, I really appreciate your time to explain it to me. I think I start understanding it all slowly... You're right that until I don't have any performance issue I shouldn't try to optimize anything. I already created some modules that I import when needed (mainly for API calls tha

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread 'sasogeek' via web2py-users
"A lighter alternative could be to add an _after_delete/_after_update callback to auth_table that would search and delete any sessions owned by the user" isn't that what cascade does? On Wednesday, 15 April 2015 16:12:01 UTC+1, Leonel Câmara wrote: > > I think we have to take the performance hit

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Leonel Câmara
Well there's no cascading even if the sessions are in the DB (which they don't need to be) since the web2py_session table doesn't reference auth_user. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google

[web2py] in model or controller?

2015-04-15 Thread Alex Glaros
Here is a regular requires is_in_db statement: gov_org_query = (db.Organization.organizationPrimaryTypeID ==1) db.GovOrgJurisdiction.organizationID.requires = IS_IN_DB(db(gov_org_query), 'Organization.id', '%(organizationFullName)s',zero=T('choose one')) is it more efficient to put these two

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

2015-04-15 Thread Sébastien Loix
Great thank you! Quiet new to Python so this one will help me a lot... 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_la

[web2py] Re: Issue with lookup foreign key / format statement in 2.10.3

2015-04-15 Thread Dave S
On Tuesday, April 14, 2015 at 2:29:48 PM UTC-7, Niphlod wrote: > > being a bug, we need to ship a new web2py. it got fixed already. we're > waiting for Massimo to release a 2.10.4. > Is that fix included in the nightly builds yet? /dps > On Tuesday, April 14, 2015 at 10:51:31 PM UTC+2, wish

[web2py] Re: in model or controller?

2015-04-15 Thread Lisandro
I think you won't notice any difference in the performance. If you care about that query, you don't have to worry, because the query will only be executed when the field needs to be rendered (in a form), or in the moment of the validation (when submitting the form). So I would say that you lea

[web2py] Re: in model or controller?

2015-04-15 Thread Niphlod
putting db.tablename.fieldname.requires = VALIDATOR() doesn't do anything BUT if you have lazy_tables turned on, this syntax would trigger the "unlazyification" of the table. "Minus points" (the reverse concept of "bonus points") for db.tablename.fieldname.requires = IS_IN_DB(db.othertable)

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Niphlod
I really don't know how to put it without hurting anyone's feeling, but the mere fact is that ATM sessions are NOT tied to users. This is correct from a logical standpoint because not every site needs authentication by default, but still needs to use sessions. This is the same kind of situation

[web2py] Re: Use model without DAL

2015-04-15 Thread Dave S
On Wednesday, April 15, 2015 at 9:56:46 AM UTC-7, Alessio Varalta wrote: > > Hi, i have to use the class model but not the connection with the database > exist and method to take the model and insert the value without DAL? > I'm not sure I understand the question. The two 2 readings that I th

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Leonel Câmara
> > I really don't know how to put it without hurting anyone's feeling, but > the mere fact is that ATM sessions are NOT tied to users Ahahah I realize that, but when you have authentication they end up being tied to the user indirectly in the user variable stored there. -- Resources: - htt

Re: [web2py] Re: in model or controller?

2015-04-15 Thread Alex Glaros
Thanks guys, Alex On Wed, Apr 15, 2015 at 11:37 AM, Niphlod wrote: > putting > > db.tablename.fieldname.requires = VALIDATOR() > > doesn't do anything BUT if you have lazy_tables turned on, this syntax > would trigger the "unlazyification" of the table. > "Minus points" (the reverse concept of

[web2py] Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Alex Glaros
Does Lazy Tables setting only have relevance if migration = True? Is it not necessary if migration = False? thanks Alex Glaros -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/li

[web2py] Re: Ractive example

2015-04-15 Thread Richard
Hello Massimo, I am looking at w3 right now... I have been able to make it works... I would like to know how your plan to integrate this into web2py... What it needs to be consider relatively stable for user to use it... Does your experiment is sufficiently well thought, it could be generalize

[web2py] Re: Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Anthony
No, it saves time in both cases (turning off migrations saves additional time). Anthony On Wednesday, April 15, 2015 at 3:29:52 PM UTC-4, Alex Glaros wrote: > > Does Lazy Tables setting only have relevance if migration = True? > > Is it not necessary if migration = False? > > thanks > > Alex Gla

[web2py] Re: Ractive example

2015-04-15 Thread Richard
If I understand to style and create a semantic ui form style I would have to create new layout and form template? forms.bs3.html -> forms.semntaic-ui.html ? Richard Le mercredi 15 avril 2015 15:30:40 UTC-4, Richard a écrit : > > Hello Massimo, > > I am looking at w3 right now... I have been ab

[web2py] Re: unknown error on production server! I need help fixing it asap ['NoneType' object is not callable]

2015-04-15 Thread Niphlod
granted, but discussing to fix this is like - kinda, please grant me a bit of exxageration - forcing a user to logout if the developer changes the password in the database. Identity verification (and the consequent "authorization") is meant to happen at a time "x" to enable accessing the app t

[web2py] Re: Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Alex Glaros
When setting lazy_tables = True I get this error 'NoneType' object has no attribute 'upload' Traceback (most recent call last): File "gluon/restricted.py", line 224, in restricted File "C:/alex/web2py/web2py/web2py/applications/ES1/models/db.py", line 56, in ckeditor.define_tables()

[web2py] Re: Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Niphlod
the code to post to be helped is the INNER exception, not the OUTER one. What's on line 69 of plugin_ckeditor ? On Wednesday, April 15, 2015 at 11:37:35 PM UTC+2, Alex Glaros wrote: > > When setting lazy_tables = True > > I get this error > 'NoneType' object has no attribute 'upload' > > Traceb

Re: [web2py] Re: Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Alex Glaros
) #lazy tables breaks this. Need to force the load of the table self.settings.table_upload.upload.requires = [ IS_NOT_EMPTY(), IS_LENGTH(maxsize=self.settings.file_length_max, minsize=self.settings.file_length_min), ## this is line

[web2py] AWS S3 SSLv3 Deprecation

2015-04-15 Thread Mark Graves
Hey everyone, I realize this is more of a server administration question than web2py in specific, but I want to make sure I cover all my bases, I recently received an email from AWS about their deprecation of SSLv3 in connecting to S3. I have an app deployed behind nginx, but the only ssl pro

Re: [web2py] Application Arquitecture advices

2015-04-15 Thread Richard Vézina
Wait if you use Angular you won't really need to care about performance issue before a lot of time... Since you are not going to experiment be performance issue except when you reload page... Richard On Wed, Apr 15, 2015 at 12:55 PM, Sébastien Loix wrote: > Thank you Richard, I really appreciat

[web2py] Re: in model or controller?

2015-04-15 Thread Alex Glaros
regarding validator "better placed in the table definition itself" what about the "represents" and "readable/writable" statements? Is there efficiency in moving those to the table definition? Alex -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/

Re: [web2py] Re: in model or controller?

2015-04-15 Thread Richard Vézina
@Simone, Is that true unlazy... if the .requires = Something is place in controller file?? I mean, models/files are parsed before controller and if ".requires = something" is in controller the model should be unlazy anyway... Richard On Wed, Apr 15, 2015 at 2:37 PM, Niphlod wrote: > putting >

Re: [web2py] Re: Does Lazy Tables setting only have relevance if migration = True?

2015-04-15 Thread Anthony
Looks like the current plugin code is not compatible with lazy tables. A quick fix is to just move the "requires" assignment into the field definition within the table definition, rather than doing it after the table definition. Anthony On Wednesday, April 15, 2015 at 5:52:54 PM UTC-4, Alex Gl

[web2py] Re: in model or controller?

2015-04-15 Thread Rod Watkins
I have this question as well. And, also, what bout custom widgets assigned after the table definition? Does that trigger the unlazification as well? TIA On Wednesday, April 15, 2015 at 3:05:23 PM UTC-7, Alex Glaros wrote: > > regarding validator "better placed in the table definition itself" > >

Re: [web2py] Re: in model or controller?

2015-04-15 Thread Niphlod
in order: @alex: same thing. if you can stuff everything inside the define_table() call you'll be sure to have everything working in the speediest way with lazy_tables. @richard: if you put a requires in the controller, the second that line is executed, the table is unlazyed. The whole point o

Re: [web2py] Application Arquitecture advices

2015-04-15 Thread Niphlod
this is the uttmost unproper and biased statement I've seen in a while. Angular doesn't make your app fast by default, and neither snappier, and neither more resource-friendly on the server. If you're good with Angular you're just pushing your logic client-side, and avoiding page reloads. This

[web2py] Re: AWS S3 SSLv3 Deprecation

2015-04-15 Thread Niphlod
the problem would arise only if you connect to S3 to fetch whatever is stored there AND you use a library that allows ONLY SSLv3. Since most of python modules manage other https algorithms without issues AND you're using S3 just as a repo to serve basically static assets, there's no issue: Amaz

Re: [web2py] Re: in model or controller?

2015-04-15 Thread Rod Watkins
Thanks Niphlod. That was very useful, especially the toolbar trick. I was not aware of that. Many thanks! Rod On Wednesday, April 15, 2015 at 3:26:36 PM UTC-7, Niphlod wrote: > > in order: > > @alex: same thing. if you can stuff everything inside the define_table() > call you'll be sure to have

[web2py] A bug in _after_insert callback's document (book)? And more.

2015-04-15 Thread Ray (a.k.a. Iceberg)
Hi folks, The book describes DAL's _after_insert() callback as: The caveat is that depending on the functionality, the callback has > different signature. > This is

[web2py] Re: A bug in _after_insert callback's document (book)? And more.

2015-04-15 Thread Anthony
> > However, I believe (at least in web2py 2.9.12) the first parameter in > _after_insert() is NOT a dict, but a Row object. Because, my web2py app > uses the following code in db.py, trying to send out a validation email to > new registrated user: > > def customized_email_verification(row, row

Re: [web2py] Application Arquitecture advices

2015-04-15 Thread Richard Vézina
Ok, you are right... I only said that as long as that page not reload and he call web2py functions which are not requesting a new page load it will reduce the amount of server side processing since the function call will have limited web2py API call... Richard On Wed, Apr 15, 2015 at 6:35 PM, Nip

Re: [web2py] Re: AWS S3 SSLv3 Deprecation

2015-04-15 Thread Mark Graves
Thank you! Mark Graves > On Apr 15, 2015, at 5:42 PM, Niphlod wrote: > > the problem would arise only if you connect to S3 to fetch whatever is stored > there AND you use a library that allows ONLY SSLv3. > Since most of python modules manage other https algorithms without issues AND > you'r

[web2py] Re: A bug in _after_insert callback's document (book)? And more.

2015-04-15 Thread Ray (a.k.a. Iceberg)
On Wednesday, April 15, 2015 at 5:11:22 PM UTC-7, Anthony wrote: > > However, I believe (at least in web2py 2.9.12) the first parameter in >> _after_insert() is NOT a dict, but a Row object. Because, my web2py app >> uses the following code in db.py, trying to send out a validation email to >>