Is is possible to hold a record in session, something like:
id = db.transactions.insert()
session.transaction = db.transactions[id]
and directly update_record the session.transaction,
session.transaction.update_record(x=y)# This throws KeyError:
'update_record'
or is it necessary to res
Got the solution myself.
The right code is:
form.custom.widget['myfield']['_checked'] =
db((db.mytable.id==id).select(db.mytable.myfield).first() #updated
form.custom.widget['myfield']._postprocessing()
On 6 Feb., 17:55, Serbitar wrote:
> I can do something like this:
>
> fields = [Field('myfi
session is not the database.
you can save the transactionid into the session and update the db in the
controller.
e.g.
id = db.transactions.insert()
session.transaction = id
db(db.transactions.id == session.transaction).update(x=y)
or you can manage transaction record in the session and updat
logging in /var/log/uwsgi-python is pertinent to uwsgi-python.
you probably have the directive --memory-report in your app configuration.
( in xml, etc.)
The two methods you described are the only available methods to achieve
such a thing.
If you have 100 records returned and you want to paginate by 20 (5 pages),
then the difference between one method or the other is negligible.
If you have 1000 records returned and you want to paginate by 20 (5
can you post the html generated by the form before submitting the record
and the "beautified" session ?
In order to avoid race conditions, web2py places some hidden fields in the
form and store a key in the session when accessing a edit form: seems that
this fields don't match, hence the traceba
Hello everyone!
In the example in the book for JOIN,
http://web2py.com/books/default/chapter/29/6#Inner-joins
how can you write a query that only returns the dogs that Alex has? I
need to have access to all the fields for Alex and all the fields for
the dogs he has (This is not my exact problem
I am not ready with this project to try out Bruno's way of setting up a
database using modules and not models.
But I want to be able to do something like this in a module:
def number_or_records(table):
count = db(db[table]).count()
--
Because experiencing your loyal love is
Sorry the message was sent before I have finished typing.
How do I get the same environment available in the module as in the
controller?
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
from gluon import *
This should give you the "current" object which has these:
current.request
current.response
current.cache
You must initialize your modules with a db instance though. So I usually do
this:
class MyModule(object):
def __init__(self, db, ...)
Thanks for pointing that out Michele. I may need to use something like this
in the future.
I was wondering about the previously. I haven't tried this yet, but as a
temporary workaround, are you able to insert buttons using JavaScript?
Il 09/02/2012 12:33, shartha ha scritto:
how can you write a query that only returns the dogs that Alex has?
you can add your filter condition to the join condition usch as:
rows = db((db.person.id==db.dog.owner)&(db.person.id==1)).select()
If I understand the quest...
M.
You have a syntax error in fony_by(keyword):
return db(db.page.title.contains(keyword).select().as_list()
Should be:
return db(db.page.title.contains(keyword)).select().as_list()
You forgot the closing parenthesis before .select().
Hi Niphlod,
No, I do not have that option / directive on.
What other directive could be the problem?.
Btw I do have:
Thanks again,
Carlos
Hi All,
I have three problems - Please help me understand how to
troubleshoot these
Problem1 - (Primary issue)
I have a table as below - How do I handle unique = True and
notnull= True fields i.e when I am doing negative testing and adding
similar fields, it throws me an exception. I am
Is that a bug or by design?
I am using JSONRPC of web2py , i want to keep JSONRPC services int its own
subfolder so not mixed with controllers for html. But web2py is not
allowing me to do so.
Here is my web2py's conttrolelr path:
/home/v3ss/web2py/applications/FastTract/controllers/
i want to
Thanks Ross.
On 9 February 2012 14:39, Ross Peoples wrote:
> from gluon import *
>
> This should give you the "current" object which has these:
>
> current.request
> current.response
> current.cache
>
> You must initialize your modules with a db instance though. So I usually
> do this:
>
> class
>
> I do not understand this properly.
>
> After explicitly importing 'current' in the controller, I made some
> progress. But why is the class definition necessary and how does it
> initialise db when db is not available in the module?
>
You don't necessarily need a class. The point is just
On 9 February 2012 15:45, Anthony wrote:
> I do not understand this properly.
>>
>> After explicitly importing 'current' in the controller, I made some
>> progress. But why is the class definition necessary and how does it
>> initialise db when db is not available in the module?
>>
>
> You don't
I saw other people requested long ago since 2009.
Why it would be a bad addition to web2py , i cant understand.
There are many uses cases for it , my case is one very good example :
To separate WEB CONTROLLER code from JSON/XML RPC Services.
On 2/9/12, Phyo Arkar wrote:
> Is that a bug or by
Dear All ,
How Can i select everything in the table the starts with A
Best Regards,
Hassan Alnatour
>
> Problem1 - (Primary issue)
> I have a table as below - How do I handle unique = True and
> notnull= True fields i.e when I am doing negative testing and adding
> similar fields, it throws me an exception.
If you set unique=True and notnull=True and then try to insert non-unique
or
Would another option be to cache the entire select and pull out the needed
records based on the "page" requested:
records = db(db.pages.active==True).select(cache=(cache.ram, 300))
I suppose that wouldn't be a good idea if there are likely to be enough
records and/or enough simultaneous users w
I have to query 3 tables which contains large number of data
I have to come up with report which displays
Employee Firstname, Lastname, Manager's FirstName, Manager's Lastname
and Organisation name.
Table Structure/Details:
1. Employee table: which contains employee information(First name,
last
>From manual:
http://web2py.com/books/default/chapter/29/6#like,-startswith,-contains,-upper,-lower
db.mytable.myfield.startswith('value')
On Thu, Feb 9, 2012 at 11:06 AM, Web2Py Freak wrote:
> Dear All ,
>
> How Can i select everything in the table the starts with A
>
> Best Regards,
> Hassan
Sound like you're looping all the records to connect different table.
I use join for the purpose and working fine though I only have about
1 records.
http://www.web2py.com/books/default/chapter/29/6?search=join#Inner-joins
On Feb 9, 8:19 am, Sonal_b wrote:
> I have to query 3 tables which c
On Thu, Feb 9, 2012 at 11:45 AM, Anthony wrote:
> from gluon import current
> current.db = db
>
I dont think that adding db to current will work properly, it can work in
SQLITE, but for sure will raise problems with another databases.
I realized that db needs to be instantiated inside a module
Sorry I just seen this message now, I ended up deleting it by accident and
wondering why no-one responded.
I will try this today. I didn't know there was a seconds() method attached
to the date. Will respond back in a couple of hours when I get to work.
--
Thanks,
Bruce
On Mon, Feb 6, 2012 at 4:
The main problem is the routing, web2py routes the second arg in url to the
function, how would web2py knows if it has to be a function or a subfolder?
IMO, controllers have to be small, less code, only code which decide the
workflow, the long code I prefer to put in modules, and there I can have
Not sure on the subfolder thing, but is it possible for you to put most of
your code into modules and just use controllers as the gateway to your
modules?
>
> I can think of two ways to do it, but I don't like either one. First
> is to formulate the query without the limitby clause and do a
> db(query).count(). That would give me the total number of records in
> the set. Then add the limitby clause to the query to get the records
> of interes
To answer your question, happen_time is a column of cash_journal. The point
of this call, is we allow people to cancel the site within 72 hours so any
money they have made in that time if they cancel they do not get. IE:
payback_types
= ['s','p'], s = sponsor bonus, p = product bonus
We use second
Thanks Omi.
I will give it a try.
Also will it possible for me put filters on table 1(say Employees) and
then perform join with other tables?
On Feb 9, 7:34 pm, Omi Chiba wrote:
> Sound like you're looping all the records to connect different table.
> I use join for the purpose and working fine
Dear ALL,
How do i use response.google_analytics_id in menu.py : my google
analytics id is Tracking ID: UA-29069723-1 ,
> Also will it possible for me put filters on table 1(say Employees) and> then
> perform join with other tables?
I'm not sure. I think it's more like join then filter.
Something like below...
query = (db.person.id==db.dog.owner) & (db.person.name.like('Omi%'))
rows = db(query).select()
On Feb 9
Dear All,
How can i use response.google_analytics_id in menu.py as i understand
i need to have a script with my analytics id , but why is the
response.google_analytics_id in menu.py and how can i use it ?
Hi
I was trying to create model/db.py for RequestTracker mysql schema, and was
fail.
I found quite good plugin_legacymysql and fixed for my needs
- added few types
- remove 'SET' lines same as remarks
- mysql data types without params (like text,)
- import form_factory from sqlhtml
With the last version, you can do this :
from gluon import current
dba = current.globalenv['db']
On Thursday, February 9, 2012 3:10:52 AM UTC-5, scausten wrote:
>
> Is is possible to hold a record in session, something like:
>
> id = db.transactions.insert()
> session.transaction = db.transactions[id]
>
> and directly update_record the session.transaction,
>
> session.transaction.update_re
Thanks Ross. I'm not sure how to do it, plus to assign the same
functionality as existing buttons. Do you have some sample from your code?
Just tried the application also on the iphone, and (smartgrid) horizontal
scroll doesn't work there either... Practically, can't reach buttons :)
Anyone e
Now that is a lot nicer then passing in the db to every module class. Does
this only work with trunk? Or the latest stable release?
On Thu, Feb 9, 2012 at 7:30 AM, omicron wrote:
> With the last version, you can do this :
>
> from gluon import current
>
> dba = current.globalenv['db']
>
>
--
On Thursday, February 9, 2012 10:30:12 AM UTC-5, omicron wrote:
>
> With the last version, you can do this :
>
> from gluon import current
>
> dba = current.globalenv['db']
>
I wonder why current.globalenv['db'] would work but current.db would not.
based on advice on the group long ago i am using a pattern like this:
in db.py:
current.myapp = Storage()
current.myapp.db = db #after db is inited
then in my module refrencing db as:
current.myapp.db
i'm using this on GAE and it has been working like a champ. the key is to
add the j
>
> based on advice on the group long ago i am using a pattern like this:
>
> in db.py:
>
>current.myapp = Storage()
>current.myapp.db = db #after db is inited
>
If that works, then current.db should work as well, no (I understand the
idea behind putting everything app-specific in curren
I dont know exactly how it works, but I had problems serializing db in to
current, so Massimo said to always pass it explicitly to classes ad
functions, I remember that SQLITE worked, but not Postgres.
--
Bruno Rocha
[http://rochacbruno.com.br]
Thanks Ross. Found that this morning. It's a typo in the book.
For future readers finding this post on a search; Make sure you put the
closing paren in the correct spot or your new error is a bit more
substantial. (Python shell returns an error saying, 'Query' object has no
attribute 'select' )
If you have just one application all you need to do is set the web2py WSGI
script alias and serve files from the web2py folder excluding admin parts.
WSGIDaemonProcess web2py display-name=%{GROUP}
WSGIProcessGroup web2py
WSGIScriptAlias /prefix /var/www/web2py/wsgihandler.py
Options +Follow
Thank you so much. I will try this and let you know how it works. =)
On Feb 9, 6:48 am, Manuele Pesenti wrote:
> Il 09/02/2012 12:33, shartha ha scritto:> how can you write a query that only
> returns the dogs that Alex has?
>
> you can add your filter condition to the join condition usch as:
if you watch the layout.html you'll find the snippet.
{{if response.google_analytics_id:}} var
_gaq = _gaq || []; _gaq.push(['_setAccount',
'{{=response.google_analytics_id}}']); _gaq.push(['_trackPageview']);
(function() { var ga = document.createElement('script'); ga.type =
'text/javascript
Is it just me ?
db(query).count(cache=(cache.ram, 60))
Won't work...
I get :
TypeError: count() got an unexpected keyword argument 'cache'
Richard
On Thu, Feb 9, 2012 at 9:44 AM, Anthony wrote:
> I can think of two ways to do it, but I don't like either one. First
>> is to formulate the qu
Under web2py 1.99.4
Richard
On Thu, Feb 9, 2012 at 12:42 PM, Richard Vézina wrote:
> Is it just me ?
>
> db(query).count(cache=(cache.ram, 60))
>
> Won't work...
>
> I get :
>
> TypeError: count() got an unexpected keyword argument 'cache'
>
> Richard
>
>
> On Thu, Feb 9, 2012 at 9:44 AM, Antho
uhm, this is the relevant part for the form I was asking for
for the "session" , just put {{=BEAUTIFY(session)}} into the template and
watch the keys
Here the strange part is that it seems that employee code is not an integer
as defined into the model but a decimal. I don't know if this
I don't think a count can be cached that way, but since it just returns a
number, it can be cached in the usual way instead:
count = cache.ram('count', lambda: db(query).count(), time_expire=60)
Anthony
On Thursday, February 9, 2012 12:42:02 PM UTC-5, Richard wrote:
>
> Is it just me ?
>
> db(q
can you post your conf ?If we don't come up with a solution we can rely on
roberto de ioris, that is one of uwsgi developers and every now and then
joins this list :D
I just check gluon/dal.py and if it is the count() code location it's not
have cache argument... Also I notice that there seems to have many
differents implementations of count... I wouder why it could not be a
generic function reused everywhere, it would be more DRY...
Richard
On Thu, Feb 9, 201
I use sqlform.grid, I use 'links' for edit and delete. These appear as
buttons on the right hand column. I have no problem accessing these
buttons on my android phone. Are you sure you are attributing the
problem correctly? My web2py website is identical on my android phone
to what appears on a com
This is my config for uwsgi-python:
127.0.0.1:9001
/home/www-data/web2py/
4
wsgihandler
Note that I use routes.py, so I'm not sure if these logging lines comes
from here (although I have logging = 'off' )?.
Thanks!
ok,
this line is dne by uwsgi, and I don't know how to turn it off.
Thu Feb 9 17:58:12 2012 - routing 0 routes 0
if you have memory report on, there will be also a line like
{address space usage: 46809088 bytes/44MB} {rss usage: 34369536 bytes/32MB}
[pid: 17838|app: 0|req: 23/90] 188.10.176.36
Markdown display using the imported WIKI function shifts text down by
about 1/2em (one half of a line). This is very annoying in a table
which no longer lines up vertically. The markdown rendered text
column shows up below the other columns across a row. This just looks
bad. Is there any reason
Then why did web2py fail with a run time error? Or why wasn't the run
time error trapped? Maybe because I had requires on the same table
for a different constraint?
It doesn't look good when visitors to your site see the web2py error
ticket page. Adding the explicit constraint prevented that.
> ok,
> this line is dne by uwsgi, and I don't know how to turn it off.
> Thu Feb 9 17:58:12 2012 - routing 0 routes 0
>
> if you have memory report on, there will be also a line like
>
> {address space usage: 46809088 bytes/44MB} {rss usage: 34369536
> bytes/32MB}
> [pid: 17838|app: 0|req: 23/90
One of my controllers need to go through a lot of records to provide a
meaningful answer -- as in, 60k records.
Just loading them from the database takes about 100ms
(db.executesql("select * from table order by id;")); Doing the same through
DAL takes over 6 seconds. I realize that the DAL does
You mean using the generated SQL command to fire execute_sql and returns as
a named tuple?
>>> db(db.query).raw_select()
it is the same as doing
command = db(db.query)._select()
result = db.execute_sql(command)
On Thu, Feb 9, 2012 at 4:51 PM, nick name wrote:
> One of my controllers need to go
What I see you are trying to say is that by keeping the code secret one
gains a temporary advantage over the competition. That might be true. But
this is the way of thinking coming from the proprietary software
philosophy. How much will I loose by making the software free? If this is
your line
Here is an easier solution:
{{=XML(joke.joke.joketext.replace('\n',''),
sanitize=True)}}
{{=joke.auth_user.first_name}}
{{=joke.auth_user.last_name}}
All I really wanted. Didn't need the rest of markdown or markmin.
BTW, MARKMIN also pads the top of the text. Curious why this is s
I can see your point even though I don't 100% agree with it. I write most
of my code opensource, however I also have been writing software for a
living for around 14 years so sometimes we don't have the choice between
open and closed source.
We also can't expect only people interested in free soft
strange, really :D
I don't mind if that turns out in the logging, but I have the same behaviour
niphlod@platypus:~$ uwsgi-python --version
uWSGI 0.9.6.8
I use uwsgi-python in production /usr/bin/uwsgi-python . If I recall
correctly that is a symbolic link to `/etc/alternatives/uwsgi-python', an
You're right !
I thought it doesn't matter but it does.
I define another table which has a same field type for key and
works !!
But I employee table doesn't work even I changed from 'string' to
'double'
"SyntaxError: user is tampering with form's record_id:
{'EmployeeCode': '61339.00'} != {'Emplo
*Movuca goals:*
*Everybody should be able to use it for free*
- Use it for creating sites, blogs and social networks (free or commercial)
*Everybody can sell it as a service*
- Use it to offer Movuca based websites as a service
- Use it for developing websites for customers
*Everybody can extend
that seems a float vs decimal problem
bottom line, I didn't get what is not working right now ?
PS: post table definition in "raw sql", model of the table as in the
models.py, and controller, so I can at least try to reproduce with sqlite
or postgres (again, sorry but I don't have DB2
Thanks for that Michele !
That is a nice trick for sharing information with different processes
reducing to the minimum the FS IO... It still has the IO bottleneck of
read/write from/to file compare with real data permanent in memory... but
still a valid approach...
On Thu, Feb 9, 2012 at 12:58 AM
Yes, that is the basis of what I am suggesting.
There is not currently such a thing; there is something called 'select_raw'
implemented in the GoogleDataStore adapter, but not in anything else, and
it isn't exactly what I am proposing.
To elaborate:
Assume the table is defined as follows:
Hi Peter...
I put a simple smartgrid together, with a longer text field... so this one
doesn't scroll horizontally for me. I'm not sure if it's something that we
did on css or somewhere, but i noticed it worked on ipad as it should...
here is the link:
http://w2p.thanedev.com/test2/test/test
I installed uwsgi via:
add-apt-repository ppa:uwsgi/release
So there's nothing I can do to turn this logging off?.
Thanks.
Thank you the help.
So far, I found...
- Ver 1.99.2 doesn't support update for primarykey
- Ver 1.99.4 does support update for primarykey if it's string
So this will fail. If it works for posgres and maybe problem with db2/
mssql. (I use DAL: mssql2). From the syntax error, it's ignore the
'inte
On Thu, Feb 9, 2012 at 4:34 PM, Bruce Wade wrote:
>
> GPL = Doesn't want anyone making money off their code and forces people to
> recommit their code. This is good because everyone gets the code, bad
> because you don't have a choice.
>
This is not completely true.
GPL has nothing to do with ma
Yes exactly what I want.
I should go with GPL3 or LGPL3 ?
On Thu, Feb 9, 2012 at 6:34 PM, Mariano Reingart wrote:
>
> This is not completely true.
>
> GPL has nothing to do with making money.
> GPL do not forces anyone to recommit their code. It only says that if
> you make a GPL derivative, you
"In my case, I need to pull all the records (60,000) from the database to
compute some aggregation which I cannot compute using sql"
Are you familiar with window functions in SQL? I've never met an
aggregation need that couldn't be met with clever use of windows...
>
> *Everybody can extend, create plugins and add functionalities or plug in
> to another apps*
> - If used to deploy a website for you or client, free or commercial I dont
> care about modifications, you can keep it as a secret (because it can have
> your own business logic)
>
> *NOBODY can cr
I've been thinking about something like this as well. Instead of a separate
select_raw() method, maybe we can just add a raw=True|False argument to the
existing select() method. I like the namedtuple idea as well (I think some
adapters already provide that as an option -- e.g., psycopg2).
Antho
Example, I can use joomla to create commercial websites for my clients,
also I can use it if I am a hosting provider to offer as a service "create
site" tool.
But I cant use Joomla to create a : *Bruno's joomla commercial platform* to
compete with Joomla.
I think if you are going to keep the code
>From your description you are wanting to go with LGPL3.
On Thu, Feb 9, 2012 at 1:21 PM, Bruno Rocha wrote:
> Example, I can use joomla to create commercial websites for my clients,
> also I can use it if I am a hosting provider to offer as a service "create
> site" tool.
>
> But I cant use Joom
In an index function I do something like
session[request.controller].something = 'foo'
This raises a key error exception on the first visit to the controller
after restarting the browser. Session can't find the controller name,
so I can't add an attribute to it. So I need to initialize the
sessi
Yes, I can not move right on your app. But surely the solution is to
find out your css's problem with android rather than move the buttons
to the left. There might be other reasons for the having the buttons
on the left, but buttons on the right work fine with android if one
can move right.
Peter
Bruno,
You already wrote it: It is the Movuca License. :-)
Ricardo
2012/2/9 Bruno Rocha
>
> *Movuca goals:*
>
> *Everybody should be able to use it for free*
> - Use it for creating sites, blogs and social networks (free or commercial)
>
> *Everybody can sell it as a service*
> - Use it to off
session is an Storage, Storages always return an attribute, defaults to
None.
You do not have to always access session objects by keys, you can do it by
attribute and it will always return an object, even if the object does not
exists.
examples
my_var = getattr(session, request.controller)
Even
On Thu, Feb 9, 2012 at 7:52 PM, R. Strusberg wrote:
> Bruno,
>
> You already wrote it: It is the Movuca License. :-)
Legally, can I use this as a license? it has any matter? or I need to
choose an existing license
(I dont know how this things works, do I need to register it?)
--
Bruno Roch
For this case, LGPL3 or GPL3 are almost indistinguishable in this
context (web app)
AFAIK, LGPL3 is better if you want that subparts of Movuca being
used/distributed in other contexts (i.e., with other closed source
CMS, or with other open source software MIT/BSD licensed)
With web2py it is more c
>
> Example, I can use joomla to create commercial websites for my clients,
> also I can use it if I am a hosting provider to offer as a service "create
> site" tool.
>
> But I cant use Joomla to create a : *Bruno's joomla commercial platform*to
> compete with Joomla.
>
> I think if you are goi
I bet you'll get better luck in courts if you use a well-known licence.
GPL has been written by lawyers and it has some enforcement
jurisprudence right now.
Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com
On Thu, Feb 9, 2012 at 6:56 PM, Bruno Rocha wrote:
>
>
> O
On Thursday, February 9, 2012 1:28:28 PM UTC-5, Lewis wrote:
>
> Then why did web2py fail with a run time error? Or why wasn't the run
> time error trapped? Maybe because I had requires on the same table
> for a different constraint?
>
I assume there must be an explicit "requires" attribute se
Hi,
In the old framework I would just query the database and loop through the
values manually creating the HTML table etc...
Which allows me to do something like this:
types = {
'bp': 'Product Bonus',
'sb': 'Sponsor Bonus',
}
for row in rows:
Type
types[row.type]
Is there a
I think it's good for people to advocate for their license
preferences.
I also think the discussion should be based on facts, so I would like
to offer some observations about statements that make me
uncomfortable.
> The freedom in software also comes the freedom of choice, to either give
> back o
Making money off the code, meaning you can't go sell the code. With BSD
code you can.
I said a lot of people, I didn't say MORE people. With BSD there is also a
lot of people using it that don't announce they are using the BSD based
software.
On Thu, Feb 9, 2012 at 2:46 PM, Cliff wrote:
> I thi
Never mind figured it out.
types = {
'bp': 'Product Bonus',
'sb': 'Sponsor Bonus',
}
db.cash_journal.transaction_type.represent = lambda transaction_type,row:
types[transaction_type]
ucashHistoryGrid = SQLFORM.grid(
db.cash_journal,
paginate=10, deletable=False, edit
Let's say the model has three tables, called country, cities and
customers that are defined like:
db.define_table('continents',
Field('name'),
)
db.define_table('countries',
Field('name'),
Field('continent', db.continents),
)
db.define_table('customers',
Field('name'),
Field('coun
You have to do this with Javascript
http://176.34.12.39/welcome/en/static/js/location.js
That is how I am handling the situation where select a continent only the
countries for that continent show in the select box.
On Thu, Feb 9, 2012 at 4:53 PM, shartha wrote:
> Let's say the model has thre
>
> I don't know what is meant by "a lot of people." But there are some
> statistics that seem to indicate a lot more people prefer the GPL. As
> of June 2009, the GPL licenses accounted for ~ 65% usage. BSD
> accounted for 6.3. Now I realize that's more than 30 months ago, or
> two centur
Hi,
I know I have been posting a lot of questions in this group, here is why:
http://176.34.12.39
The port is about 90% complete now after 1.5 months of work :D
Have removed 100s of lines of code in some parts of the application. Let me
know what you think so far. The database is just junk data
1 - 100 of 114 matches
Mail list logo