Re: [web2py] Re: Two grids, different behaviour.

2014-02-04 Thread Johann Spies
Thanks.  I did not know about that.

Regards
Johann


On 4 February 2014 16:26, Anthony  wrote:

> If there are args in your URL not generated by the grid, you have to tell
> the grid about it so it knows to include those args in the URLs it
> generates (otherwise it just includes its own args). So, if you are using
> the first URL arg for something, then do:
>
> SQLFORM.grid(..., args=request.args[:1])
>
> Anthony
>
>
> On Tuesday, February 4, 2014 7:01:04 AM UTC-5, Johann Spies wrote:
>>
>> I have the following models:
>>
>> db.define_table('survey',
>> Field('name', label = 'Name of the new survey',
>>   requires = IS_NOT_IN_DB(db, 'survey.name'),
>>   unique = True),
>> Field('owner', db.auth_user, default = auth.user_id,
>>readable = True, writable = False),
>> Field('startdate', 'date'),
>> Field('enddate', 'date'),
>> format='%(name)s')
>>
>> db.define_table('questions',
>> Field('survey_id', db.survey),
>> Field('question_number', requires = IS_NOT_EMPTY()),
>> Field('question', 'text', requires = IS_NOT_EMPTY(),
>>   represent = lambda value,row: XML(value),
>>   widget = advanced_editor),
>> Field('answer_type', 'integer',
>>   requires=IS_IN_SET(ANSWER_TYPE)))
>>
>> db.define_table('options',
>> Field('question_id', db.questions),
>> Field('option_number'),
>> Field('option'))
>>
>>
>> When using the following grid, I can use the standard View/Edit/Delete
>> buttons and it works as expected:
>>
>>  survey_id = request.get_vars.survey_id
>> query = db.questions.survey_id==survey_id
>> fields = [db.questions.question_number,
>>   db.questions.question,db.questions.answer_type,
>>   db.questions.id]
>> questions = SQLFORM.grid(query,
>>  editable = True,
>>  deletable = True,
>>  create = True,
>>  searchable = False,
>>  maxtextlength = 100,
>>  orderby=db.questions.question_number
>>  , user_signature = True)
>>
>> Example of url: http://localhost:8000/survey_
>> app/default/edit_survey/edit/questions/2745?survey_id=220&_signature=
>> 1e41f2ab5820fe9422d7f1a552f61136cefb26a9
>>
>>
>> But with this one, using anyone of those buttons ends with a 404 Not
>> found message:
>>
>> qid = request.args(0,cast=int)
>> query = db.options.question_id == qid
>> fields = [db.options.id, db.options.option_number, db.options.option]
>> form = SQLFORM.grid(query,
>> editable = True,
>> deletable = True,
>> searchable = False,
>> maxtextlength = 100,
>> fields = fields,
>> user_signature = True,
>> create = False)
>>
>> Example of url: http://localhost:8000/survey_
>> app/default/edit_options/edit/options/4694?_signature=
>> ec61c90b8595bb73539a0e364f8f4e422f641dd7
>>
>> Question: Why can the second grid not find the records when I use the
>> buttons?
>> Both the id's in the url's (2745 and 4694) are valid.
>>
>> Regards
>> Johann
>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] error postgresql with table new :S

2014-02-04 Thread Luis Díaz
db = DAL('postgres://usuario:puerto@localhost:5432/welcome',
pool_size=1,check_reserved=['all'], fake_migrate_all=True)


db.define_table('denuncia',

Field('status', 'integer', default=0, writable=False,
readable=False),
Field('descripcion', 'text'),

Field('ip', 'string', default=request.client,
update=request.client, writable=False, readable=False),
Field('fecha', 'date', default=request.now, update=request.now,
writable=False, readable=False),

Field('victima', db.auth_user, default=auth_user_id,
writable=False, readable=False),
Field('auth_user', db.auth_user, writable=False,
readable=False),


#format = lambda row: '%s %s' %(row.auth_user.username)
)

#requires
db.denuncia.descripcion.requires = [
IS_UPPER(),
IS_LENGTH(maxsize=256, minsize=20),
IS_NOT_EMPTY(),
]



timestamp: 2014-02-05T04:21:31.624321
CREATE TABLE denuncia(
id SERIAL PRIMARY KEY,
status INTEGER,
descripcion TEXT,
ip VARCHAR(512),
fecha DATE,
victima INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
auth_user INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
);
faked!

web2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
PythonPython 2.6.6: /usr/bin/python (prefix: /usr)

Traceback

Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File
"/home/www-data/web2py/applications/welcome/controllers/denuncia.py", line
95, in 
  File "/home/www-data/web2py/gluon/globals.py", line 372, in 
self._caller = lambda f: f()
  File "/home/www-data/web2py/gluon/tools.py", line 3239, in f
return action(*a, **b)
  File
"/home/www-data/web2py/applications/welcome/controllers/denuncia.py", line
67, in admin
denuncia_rows = db(db.denuncia.auth_user>0)(db.auth_user.id
==db.denuncia.auth_user)(db.auth_user.registration_key!='blocked').select(db.denuncia.ALL)
  File "/home/www-data/web2py/gluon/dal.py", line 10335, in select
return adapter.select(self.query,fields,attributes)
  File "/home/www-data/web2py/gluon/dal.py", line 1831, in select
return self._select_aux(sql,fields,attributes)
  File "/home/www-data/web2py/gluon/dal.py", line 1796, in _select_aux
self.execute(sql)
  File "/home/www-data/web2py/gluon/dal.py", line 1916, in execute
return self.log_execute(*a, **b)
  File "/home/www-data/web2py/gluon/dal.py", line 1910, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
ProgrammingError: permiso denegado a la relación denuncia

Error snapshot

(permiso denegado a la relación denuncia
)--


http://diazluis.com
Analista Programador
User Linux 532223

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Satchless and web2py for e-commerce?

2014-02-04 Thread LightDot
I don't think EStore is using Satchless, or am I missing something... It's 
late over here, I wouldn't be surprised :)

Regards


On Wednesday, February 5, 2014 4:00:31 AM UTC+1, samuel bonill wrote:
>
> yes, look :
>
> https://github.com/mdipierro/web2py-appliances/tree/master/EStore
>
> El martes, 4 de febrero de 2014 06:31:45 UTC-5, Michele Comitini escribió:
>>
>> This project seems interesting to build e-shops with.
>>
>> http://satchless.com/
>>
>> Has anyone tried it coupled with web2py?
>>
>> mic
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Satchless and web2py for e-commerce?

2014-02-04 Thread samuel bonill
this app was build with web2py :

nammuhats.com

El martes, 4 de febrero de 2014 06:31:45 UTC-5, Michele Comitini escribió:
>
> This project seems interesting to build e-shops with.
>
> http://satchless.com/
>
> Has anyone tried it coupled with web2py?
>
> mic
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Satchless and web2py for e-commerce?

2014-02-04 Thread samuel bonill
yes, look :

https://github.com/mdipierro/web2py-appliances/tree/master/EStore

El martes, 4 de febrero de 2014 06:31:45 UTC-5, Michele Comitini escribió:
>
> This project seems interesting to build e-shops with.
>
> http://satchless.com/
>
> Has anyone tried it coupled with web2py?
>
> mic
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Started web2py - doesn't not offer to run on my local IP

2014-02-04 Thread Jim S
See attached screenshot.  ipconfig on my machine shows my IPv4 Address as 
192.168.125.112.

But, web2py doesn't offer this as an IP to use for my testing.

Can anyone tell me how to get my local IP available to use?  Need to test 
with iPad

-Jim

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<>

[web2py] Re: Model or ModelLess?

2014-02-04 Thread Anthony
It can be more efficient because the modules only have to be read in once 
upon first import, and you can then easily import and define just the 
models you need for a given request. By default, all model files are read 
and executed on every request. Model files can be executed conditionally, 
but even in that case, the whole file must be read and executed each time. 
On the other hand, it's easier to access the web2py API in model files.

Anthony

On Tuesday, February 4, 2014 5:13:53 PM UTC-5, Ruud Schroen wrote:
>
> I see some applications in web2py appliances that use modules instead of 
> models.
>
> Is there an advantage to this?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Model or ModelLess?

2014-02-04 Thread Ruud Schroen
I see some applications in web2py appliances that use modules instead of 
models.

Is there an advantage to this?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Is there a more Python-ic, Web2Py-ish way to accomplish this query?

2014-02-04 Thread A36_Marty
I wrote the following query function that works fine / accomplishes the 
goal.  However, being new to web2py, Python, etc., I'm wondering if I am 
missing much smarter/better ways to accomplish the same outcome -- so as to 
better guide my future efforts.

Thanks in advance for the advice.

Table being queried;
db.define_table('trades',
Field('account_id', db.accounts, required=True, 
notnull=True, label="Brokerage Account"),
Field('trxn_date', 'date', required=True, notnull=True, 
label="Transaction Date"),
Field('trxn_type', 'string', required=True, label="Buy or 
Sell"),
Field('risk_amt', 'double', required=True, notnull=True, 
label="Risk Amount"),
Field('symbol', 'string', required=True, notnull=True, 
label="Securities Symbol"),
Field('share_price', 'double', required=True, 
label="Purchase Price Per Share"),
Field('share_qty', 'double', required=True, label="Share 
Quantity"))

Goal of query:
I want to get a list of all open positions -- i.e. if 100 shares of a 
security is bought and 100 is sold, there's no open position; return 
nothing.   If 100 is bought and 99 is sold, there is an open position...

def get_open_positions(account_id=0L):

open_positions = []

#Get a list of all symbols for the account
all_symbols_in_acct = db(db.trades.account_id == 
account_id).select(db.trades.symbol, groupby=db.trades.symbol)

#Sum up all the buys and sells for each symbol
#e.g. Buy 100 FB, Sell 100 FB, Buy 100 AMZN, etc..
for symbol_row in all_symbols_in_acct:
#Get Sum of buys for symbol
qry = ((db.trades.account_id == account_id) &
   (db.trades.symbol == symbol_row.symbol) &
   (db.trades.trxn_type == "Buy"))
sum = db.trades.share_qty.sum()
share_qty_purchased = db(qry).select(sum).first()[sum]
share_qty_purchased = share_qty_purchased if share_qty_purchased != 
None else 0.0

#Get Sum of sells for symbol
qry = ((db.trades.account_id == account_id) &
   (db.trades.symbol == symbol_row.symbol) &
   (db.trades.trxn_type == "Sell"))
sum = db.trades.share_qty.sum()
share_qty_sold = db(qry).select(sum).first()[sum]
share_qty_sold = share_qty_sold if share_qty_sold != None else 0.0

#If the buys don't match the sells, there's open positions
#Return the related trade rows
if share_qty_purchased != share_qty_sold:
trxn_total = (db.trades.share_qty * db.trades.share_price).sum()
qry = ((db.trades.account_id == account_id) &
   (db.trades.symbol == symbol_row.symbol) &
   (db.trades.trxn_type == "Buy"))
buys_trxn_total = db(qry).select(trxn_total).first()[trxn_total]
buys_trxn_total = buys_trxn_total if buys_trxn_total != None 
else 0.0

qry = ((db.trades.account_id == account_id) &
   (db.trades.symbol == symbol_row.symbol) &
   (db.trades.trxn_type == "Sell"))
sells_trxn_total = 
db(qry).select(trxn_total).first()[trxn_total]
sells_trxn_total = sells_trxn_total if sells_trxn_total != None 
else 0.0

shares_open = (share_qty_purchased-share_qty_sold)
if shares_open > 0:
#A Long Position
avg_cost = (buys_trxn_total/share_qty_purchased)
else:
#A Short Position
avg_cost = (sells_trxn_total/share_qty_purchased)


position = {'symbol': symbol_row.symbol,
'shares': shares_open,
'avg_cost': avg_cost}

open_positions.append(position)

return open_positions

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Problems with the server stalling out. Setting up debuging.

2014-02-04 Thread Ricardo Pedroso
On Tue, Feb 4, 2014 at 8:11 PM, Niphlod  wrote:

>
>
> On Tuesday, February 4, 2014 8:43:16 PM UTC+1, Encompass solutions wrote:
>>
>> HMM, the processes are very fast and never take long. maybe 5 seconds,
>> but most of the time 1 or 2 seconds. Do I really need create a queing
>> server for this? It's going to be a lot of database reading to make it
>> happen smoothly.
>> BR,
>> Jason Brower
>>
>
Just to clear thing out

Jason, can you replicate the problem only going to
melodigram.com/melodigram/default/gram/b662a1da-8c2b-11e3-b0dc-1231390a0101
and repeatedly refresh the browser several times?

This URL doesn't call any external program, right?


Ricardo

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Setting DAL less strict from a model

2014-02-04 Thread Michele Comitini
Hi Rene,



try testing with trunk, remove check_reserved and add the following to DAL
parameters:

DAL(., entity_quoting=True) after that you should have no conflict with
reserved SQL words.
You should be able to use any name, e.g. do things like
define_table('table', Field('select'), Field('update'))

Let us know if that works.

mic



2014-02-04 Rene Dohmen :

> Hi Web2py-users,
>
> I have developed a CMS kind of system based on web2py.
> https://github.com/acidjunk/web2py-pages
>
> I actually want to provide a release as a w2p file on a regular basis, so
> it can be used more easily. But I'm running into a problem if I don't
> overwrite any core web2py app files.
> https://github.com/acidjunk/web2py-pages/blob/master/README.md
>
> When I started the development (web2py 1.97.2) I made some DB naming
> choices that gave problems later on, when using strict(er) mode in DAL. The
> key problem is that we choose 'page' for our main table containing the
> pages. Obviously a lot of code in the page controller is using 'page' also
> for adding, editing and sorting pages; and I also have some projects in
> production that use it already. So a rename is not that straight forward or
> easy...
>
> I did investigate the web2py docs to see if I could relax the strict mode
> from a model that would be included after db.py; but that doesn't seem to
> be possible.
>
> Any help is appreciated.
>
> Kind Regards
>
> Rene
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: dal retrieve one element from auth_user results in exception when none found

2014-02-04 Thread Dave S
On Tuesday, February 4, 2014 7:57:28 AM UTC-8, Boris Aramis Aguilar 
Rodríguez wrote: 

> now all .pyc files are in my gitignore :)
>

Wisdom of the ages!

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Problems with the server stalling out. Setting up debuging.

2014-02-04 Thread Niphlod


On Tuesday, February 4, 2014 8:43:16 PM UTC+1, Encompass solutions wrote:
>
> HMM, the processes are very fast and never take long. maybe 5 seconds, 
> but most of the time 1 or 2 seconds. Do I really need create a queing 
> server for this? It's going to be a lot of database reading to make it 
> happen smoothly. 
> BR, 
> Jason Brower 
>

even if "usually" they take 5 seconds, it seems that you're facing problems 
with runaway processes hanging around until apaches goes into timeout 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Problems with the server stalling out. Setting up debuging.

2014-02-04 Thread Jason Brower
HMM, the processes are very fast and never take long. maybe 5 seconds,
but most of the time 1 or 2 seconds. Do I really need create a queing
server for this? It's going to be a lot of database reading to make it
happen smoothly.
BR,
Jason Brower

On Tue, 2014-02-04 at 07:05 -0800, Niphlod wrote:
> that's the problem!!! 
> Running external programs within the webserver execution model causes
> the thread to be killed if the request takes too much.
> It's process handling 101: NEVER spawn processes from the web
> application!
> 
> On Monday, February 3, 2014 10:06:32 PM UTC+1, Encompass solutions
> wrote:
> Thanks for the pointers! 
> I run two programs... avconv (ffmpeg) and sox both handle
> file 
> conversions at the moment an upload happens. They bail pretty
> easily if 
> there was an error.  They are using files I have stored
> according to my 
> model. 
> BR, 
> Jason Brower 
> 
> On Mon, 2014-02-03 at 19:08 +, Ricardo Pedroso wrote: 
> > 
> > On Sun, Feb 2, 2014 at 6:14 PM, Jason Brower
>  
> > wrote: 
> > 
> > It seems that I have an issue I can't resolve. 
> > Every once in a while at seemingly the worst and
> most random 
> > times, the 
> > service will stall out.  It simply doesn't respond
> to 
> > anything. 
> > Going into the computer and running htop shows that
> the 
> > computer is 
> > doing nothing. 
> > I am not running the server with a compiled version
> of my 
> > code. 
> > I am running: 
> > 2.8.2-stable+timestamp.2013.11.28.13.54.07 
> > (Running on Apache/2.2.22 (Ubuntu), Python 2.7.3) 
> > The application does only basic uploading and
> loading of a 
> > single item. 
> > Here is an example of the webplayer: 
> >
> 
> melodigram.com/melodigram/default/gram/b662a1da-8c2b-11e3-b0dc-1231390a0101 
> > 
> >   
> > I can run F5 reloads on the site for 15 minutes
> straight, not 
> > have 
> > anyone access the system then then try to load
> something, be 
> > it the 
> > admin interface or the page I show you here and it
> site for a 
> > very long 
> > time.  The time it is unresponsive seems random, but
> that's 
> > because I 
> > haven't discovered how to replicate the problem. 
> > If I restart apache and try, it seems to work every
> time. 
> > 
> > 
> > This king of issues are hard to know exactly, where the
> problem is, 
> > without having a clear picture of the application and the 
> > infrastructure. 
> > 
> > 
> > For sure, something is holding apache worker threads for a
> long time 
> > or indefinitely. 
> > 
> > 
> > when a request for 
> >
> 
> melodigram.com/melodigram/default/gram/b662a1da-8c2b-11e3-b0dc-1231390a0101 
> > 
> > is running: 
> > 
> > 
> > Are you using any third party C extension? 
> > 
> > 
> > Are you calling any external program? 
> > 
> > 
> > Where are the files, that are retrieved by the download
> function, 
> > stored? In the same 
> > box, or been retrieved from a remote location? 
> > 
> > 
> > the first thing I would try is using strace utility against
> an apache 
> > worker thread to see 
> > 
> > were it is sitting. 
> > 
> > 
> > Ricardo 
> > 
> > -- 
> > Resources: 
> > - http://web2py.com 
> > - http://web2py.com/book (Documentation) 
> > - http://github.com/web2py/web2py (Source code) 
> > - https://code.google.com/p/web2py/issues/list (Report
> Issues) 
> > --- 
> > You received this message because you are subscribed to a
> topic in the 
> > Google Groups "web2py-users" group. 
> > To unsubscribe from this topic, visit 
> >
> https://groups.google.com/d/topic/web2py/BZQF88jug54/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an
> email to 
> > web2py+un...@googlegroups.com. 
> > For more options, visit
> https://groups.google.com/groups/opt_out. 
> 
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/we

[web2py] Re: Anyway to interact with SQL Database?

2014-02-04 Thread Anthony
Do you have an app set up with models for this db? If so, assuming you're 
running web2py from source, at the command line do:

python web2py.py -S yourapp -M

Anthony

On Tuesday, February 4, 2014 2:00:40 PM UTC-5, Austin Taylor wrote:
>
> I am using mysql. I've tried importing MySQLdb, pymysql, and importing 
> DAL. I want to have an interactive prompt that I can practice querying 
> tables on. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Anyway to interact with SQL Database?

2014-02-04 Thread Richard Vézina
Start web2py with the command line (see web2py API in core chapter) and
load your model the switch is -M...

python web2py.py ... -M

It will start a python shell with web2py environnement so you can
interactively type you command to web2py...

:)

Richard


On Tue, Feb 4, 2014 at 2:00 PM, Austin Taylor  wrote:

> I am using mysql. I've tried importing MySQLdb, pymysql, and importing
> DAL. I want to have an interactive prompt that I can practice querying
> tables on.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Anyway to interact with SQL Database?

2014-02-04 Thread Austin Taylor
Perfect!  Thank you
On Feb 4, 2014 2:00 PM, "Austin Taylor"  wrote:

> I am using mysql. I've tried importing MySQLdb, pymysql, and importing
> DAL. I want to have an interactive prompt that I can practice querying
> tables on.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/3BgAmfpELvc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Anyway to interact with SQL Database?

2014-02-04 Thread Austin Taylor
I am using mysql. I've tried importing MySQLdb, pymysql, and importing DAL. 
I want to have an interactive prompt that I can practice querying tables 
on. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: login_next and next var

2014-02-04 Thread Jonathan Lundell
On 4 Feb 2014, at 10:32 AM, Annet  wrote:
> Notice extra ' before 'URL
> 
> When I remove the ' '  around the URL
> 
>  Login
> 
> The button is rendered the following way:
> 
> Login
> 
> The first =URL converted to a url the second =URL is not.
> 
> Is what I want not possible?

It's a URL; it's just %-escaped because it's in a query string (vars).

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login_next and next var

2014-02-04 Thread Annet


> Notice extra ' before 'URL
>

When I remove the ' '  around the URL

 Login

The button is rendered the following way:

Login

The first =URL converted to a url the second =URL is not.

Is what I want not possible?


Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Setting DAL less strict from a model

2014-02-04 Thread Rene Dohmen
Hi Web2py-users,

I have developed a CMS kind of system based on web2py. 
https://github.com/acidjunk/web2py-pages

I actually want to provide a release as a w2p file on a regular basis, so 
it can be used more easily. But I'm running into a problem if I don't 
overwrite any core web2py app files.
https://github.com/acidjunk/web2py-pages/blob/master/README.md

When I started the development (web2py 1.97.2) I made some DB naming 
choices that gave problems later on, when using strict(er) mode in DAL. The 
key problem is that we choose 'page' for our main table containing the 
pages. Obviously a lot of code in the page controller is using 'page' also 
for adding, editing and sorting pages; and I also have some projects in 
production that use it already. So a rename is not that straight forward or 
easy...

I did investigate the web2py docs to see if I could relax the strict mode 
from a model that would be included after db.py; but that doesn't seem to 
be possible.

Any help is appreciated.

Kind Regards

Rene

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Richard Vézina
Yes!

You right, I am just the man in the midle on this one...

I have someone that tries the stuff for me.

We try also to get the hidden form stuff with form.hidden_fields() as you
suggest and get all the thing done from the controller... The form html
seems valid html form but it failed to submit...

Anyway, wrapping the form with begin and end in the view is find for now.

If we get time we will look at web2py and try to make it works from the
controller

Thanks Anthony.

Richard


On Tue, Feb 4, 2014 at 11:13 AM, Anthony  wrote:

> Seems fine, then. You can always try it and see if it works.
>
>
> On Tuesday, February 4, 2014 10:59:41 AM UTC-5, Richard wrote:
>
>> a bunch of form.custom.widget.field (not sure of the synthax) wrapped in
>> a table for instance to change the display of the form...
>>
>> Richard
>>
>>
>> On Tue, Feb 4, 2014 at 10:54 AM, Anthony  wrote:
>>
>>> Hard to say without knowing what my_manipulate_form_containing_var is.
>>>
>>>
>>> On Tuesday, February 4, 2014 10:48:15 AM UTC-5, Richard wrote:
>>>
 So :

 My view should look like that

 {{=form.custom.begin}}
 {{=my_manipulate_form_containing_var}}
 {{=form.custom.begin}}

 ?

 Richard


 On Tue, Feb 4, 2014 at 10:42 AM, Anthony  wrote:

> Yes. Note, custom.begin and custom.end are a bit odd in that they are
> not web2py HTML helper objects -- this is because they do not represent a
> complete HTML element (one includes the opening form tag, and the other
> includes the closing form tag). Rather than manipulate form.custom.begin,
> it would probably be easier to just insert the relevant HTML into the view
> manually. As for form.custom.end, do you really need to do anything with
> that? It's just the hidden fields that web2py needs plus the  tag.
> Anyway, you can get just the hidden fields with form.hidden_fields().
>
> Anthony
>
>
> On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:
>>
>> Hello,
>>
>> We are trying to manipulate form (a SQLFORM or a .factory) in the
>> controller and then pass the customized form to the view. We want to do
>> this to minimize the code at view level... But we face some quirks with
>> form.custom.begin and .end
>>
>> May custom form be used from the controller like this??
>>
>> Thanks
>>
>> Richard
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to web2py+un...@googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Anthony
Seems fine, then. You can always try it and see if it works.

On Tuesday, February 4, 2014 10:59:41 AM UTC-5, Richard wrote:
>
> a bunch of form.custom.widget.field (not sure of the synthax) wrapped in a 
> table for instance to change the display of the form...
>
> Richard
>
>
> On Tue, Feb 4, 2014 at 10:54 AM, Anthony  >wrote:
>
>> Hard to say without knowing what my_manipulate_form_containing_var is.
>>
>>
>> On Tuesday, February 4, 2014 10:48:15 AM UTC-5, Richard wrote:
>>
>>> So :
>>>
>>> My view should look like that
>>>
>>> {{=form.custom.begin}}
>>> {{=my_manipulate_form_containing_var}}
>>> {{=form.custom.begin}}
>>>
>>> ?
>>>
>>> Richard
>>>
>>>
>>> On Tue, Feb 4, 2014 at 10:42 AM, Anthony  wrote:
>>>
 Yes. Note, custom.begin and custom.end are a bit odd in that they are 
 not web2py HTML helper objects -- this is because they do not represent a 
 complete HTML element (one includes the opening form tag, and the other 
 includes the closing form tag). Rather than manipulate form.custom.begin, 
 it would probably be easier to just insert the relevant HTML into the view 
 manually. As for form.custom.end, do you really need to do anything with 
 that? It's just the hidden fields that web2py needs plus the  tag. 
 Anyway, you can get just the hidden fields with form.hidden_fields().

 Anthony


 On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:
>
> Hello,
>
> We are trying to manipulate form (a SQLFORM or a .factory) in the 
> controller and then pass the customized form to the view. We want to do 
> this to minimize the code at view level... But we face some quirks with 
> form.custom.begin and .end
>
> May custom form be used from the controller like this??
>
> Thanks
>
> Richard
>
  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to web2py+un...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Richard Vézina
a bunch of form.custom.widget.field (not sure of the synthax) wrapped in a
table for instance to change the display of the form...

Richard


On Tue, Feb 4, 2014 at 10:54 AM, Anthony  wrote:

> Hard to say without knowing what my_manipulate_form_containing_var is.
>
>
> On Tuesday, February 4, 2014 10:48:15 AM UTC-5, Richard wrote:
>
>> So :
>>
>> My view should look like that
>>
>> {{=form.custom.begin}}
>> {{=my_manipulate_form_containing_var}}
>> {{=form.custom.begin}}
>>
>> ?
>>
>> Richard
>>
>>
>> On Tue, Feb 4, 2014 at 10:42 AM, Anthony  wrote:
>>
>>> Yes. Note, custom.begin and custom.end are a bit odd in that they are
>>> not web2py HTML helper objects -- this is because they do not represent a
>>> complete HTML element (one includes the opening form tag, and the other
>>> includes the closing form tag). Rather than manipulate form.custom.begin,
>>> it would probably be easier to just insert the relevant HTML into the view
>>> manually. As for form.custom.end, do you really need to do anything with
>>> that? It's just the hidden fields that web2py needs plus the  tag.
>>> Anyway, you can get just the hidden fields with form.hidden_fields().
>>>
>>> Anthony
>>>
>>>
>>> On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:

 Hello,

 We are trying to manipulate form (a SQLFORM or a .factory) in the
 controller and then pass the customized form to the view. We want to do
 this to minimize the code at view level... But we face some quirks with
 form.custom.begin and .end

 May custom form be used from the controller like this??

 Thanks

 Richard

>>>  --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: dal retrieve one element from auth_user results in exception when none found

2014-02-04 Thread Boris Aramis Aguilar Rodríguez
Everything is fine... it was a mistake on my behalf sorry :S it seems that
i pulled some pre-compiled pyc stuff from a partner im working with that
made some weird side effects; now all .pyc files are in my gitignore :)

Thanks!

Boris Aramis Aguilar Rodríguez
 Technology Projects Entrepreneur
 IT Services
 (502) 5633 1847
m...@borisaguilar.com
 http://borisaguilar.com



2014-02-04 Anthony :

> On Tuesday, February 4, 2014 10:30:25 AM UTC-5, Massimo Di Pierro wrote:
>>
>> Should have been:
>>
>> a = db.auth_user(username = 'admin')
>>
>
> The __call__ method of Table can also take a query as the first argument,
> so the original version should work as well (in fact, it works when I try
> it, on a slightly more recent version than Boris).
>
> Anthony
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/PQTTd-RWQEM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Richard Vézina
So :

My view should look like that

{{=form.custom.begin}}
{{=my_manipulate_form_containing_var}}
{{=form.custom.begin}}

?

Richard


On Tue, Feb 4, 2014 at 10:42 AM, Anthony  wrote:

> Yes. Note, custom.begin and custom.end are a bit odd in that they are not
> web2py HTML helper objects -- this is because they do not represent a
> complete HTML element (one includes the opening form tag, and the other
> includes the closing form tag). Rather than manipulate form.custom.begin,
> it would probably be easier to just insert the relevant HTML into the view
> manually. As for form.custom.end, do you really need to do anything with
> that? It's just the hidden fields that web2py needs plus the  tag.
> Anyway, you can get just the hidden fields with form.hidden_fields().
>
> Anthony
>
>
> On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:
>>
>> Hello,
>>
>> We are trying to manipulate form (a SQLFORM or a .factory) in the
>> controller and then pass the customized form to the view. We want to do
>> this to minimize the code at view level... But we face some quirks with
>> form.custom.begin and .end
>>
>> May custom form be used from the controller like this??
>>
>> Thanks
>>
>> Richard
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Anthony
Hard to say without knowing what my_manipulate_form_containing_var is.

On Tuesday, February 4, 2014 10:48:15 AM UTC-5, Richard wrote:
>
> So :
>
> My view should look like that
>
> {{=form.custom.begin}}
> {{=my_manipulate_form_containing_var}}
> {{=form.custom.begin}}
>
> ?
>
> Richard
>
>
> On Tue, Feb 4, 2014 at 10:42 AM, Anthony  >wrote:
>
>> Yes. Note, custom.begin and custom.end are a bit odd in that they are not 
>> web2py HTML helper objects -- this is because they do not represent a 
>> complete HTML element (one includes the opening form tag, and the other 
>> includes the closing form tag). Rather than manipulate form.custom.begin, 
>> it would probably be easier to just insert the relevant HTML into the view 
>> manually. As for form.custom.end, do you really need to do anything with 
>> that? It's just the hidden fields that web2py needs plus the  tag. 
>> Anyway, you can get just the hidden fields with form.hidden_fields().
>>
>> Anthony
>>
>>
>> On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:
>>>
>>> Hello,
>>>
>>> We are trying to manipulate form (a SQLFORM or a .factory) in the 
>>> controller and then pass the customized form to the view. We want to do 
>>> this to minimize the code at view level... But we face some quirks with 
>>> form.custom.begin and .end
>>>
>>> May custom form be used from the controller like this??
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>  -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2014-02-04 Thread step
My setup_exe.py is attached. It adds matplotlib. My setup_exe.conf is the 
standard one plus copy_scripts: No.
I also strip some folders/files from web2py_win.zip, namely:
applications/admin, applications/welcome (but include welcome.w2p), 
applications/examples, tcl8.5/tzdata, and tk8.5/demos.
This way of building the win package has worked for me up until 2.6.4. Like 
I said it also works for 2.8.2 provided that I don't slim down library.zip 
- you can see from the attached file that I simply commented out that code 
block.
I tested swapping in/out a fat and a lean library.zip, and each time the 
lean library.zip is used python can't import module http.

On Tuesday, February 4, 2014 4:02:14 PM UTC+1, Niphlod wrote:
>
> how are you "custom building" the binary ?
>
> The "official" scripts deals with py2exe's incorrect packaging system with 
> these lines
>
>
> https://github.com/web2py/web2py/blob/master/extras/build_web2py/setup_exe.py#L100
>
> BTW: we're moving towards bbfreeze packed binaries, and they seem to work 
> well with bbreeze 0.13
>
> On Tuesday, February 4, 2014 12:50:54 PM UTC+1, step wrote:
>>
>> In upgrading from 2.6.4 to 2.8.2 my custom-built web2py_no_console.exe 
>> failed starting the rocket server with a 'can't import module http' python 
>> error. It's something seemingly unrelated to the other posters' issues, but 
>> I'm sharing how I was able to fix it, maybe it will help someone.
>> Essentially the fix consists in editing web2py_exe.py and commenting out 
>> the new code block that slims down library.zip. That was it, in my case. I 
>> rebuilt my web2py_no_console.exe with the fatter library.zip and the import 
>> error went away. The new code was added in 2.8.2, apparently it's harmless 
>> but in my case it makes the difference between a working 
>> web2py_no_console.exe and a broken one. I wonder, maybe there is a reason 
>> why py2exe builds a larger library.zip file so seemingly full of 
>> duplicates. For the record, I wish the size trimming had worked - in my 
>> case it had shrunk library.zip from 16MB down to about 6MB. 
>>
>> On Saturday, January 18, 2014 7:08:58 PM UTC+1, Niphlod wrote:
>>>
>>> we're trying to come up with something here 
>>> http://code.google.com/p/web2py/issues/detail?id=1809
>>>
>>> if you have any inputs please share ^_^
>>>
>>> On Saturday, January 18, 2014 1:30:33 AM UTC+1, Ray (a.k.a. Iceberg) 
>>> wrote:



 On Sunday, December 15, 2013 10:00:19 AM UTC-7, Rob Paire wrote:
>
> Hello all,
>  I am having same problem running on Windows server 2003 32bit. When I 
> launch web2py.exe the following dialog error appears: 
>
> *Title: Error Entry Point Not Found*
>
> *Description: The procedure entry point wcscpy_s could not be located 
> in the dynamic link library msvcrt.dll*
>
> Clicking OK returns control to the web2py executable which fails with 
> the following console message:
>
> C:\web2py>web2py
> Traceback (most recent call last):
>   File "", line 6, in 
>   File "__main__.py", line 128, in 
>   File "__main__web2py__.py", line 18, in 
>   File "/home/mdipierro/make_web2py/web2py/gluon/__init__.py", line 
> 15, in  le>
>   File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 19, 
> in  e>
>   File "/home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py", line 10, 
> in  >
>   File "SimpleXMLRPCServer.py", line 102, in 
>   File "xmlrpclib.py", line 144, in 
>   File "httplib.py", line 79, in 
>   File "mimetools.py", line 6, in 
>   File "tempfile.py", line 35, in 
>   File "random.py", line 879, in 
>   File "random.py", line 97, in __init__
>   File "random.py", line 111, in seed
> WindowsError: [Error -2146893795] Provider DLL failed to initialize 
> correctly
>
> I reverted back to 2.7.4 for the time being.
>
>  
 Same problem here.  I guess that *msvcrt.dll* thing is because the 
 web2py282 windows builder is running on a different Windows platform than 
 before.
 Now I have to roll back.

>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
  
#Adapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py
  
USAGE = """
Usage:
Copy this and setup_exe.conf to web2py root folder
To build with py2exe:
Install py2exe: http://sourceforge.net/projects/py2exe/files/
run python setup_exe.py py2

Re: [web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Anthony
Yes. Note, custom.begin and custom.end are a bit odd in that they are not 
web2py HTML helper objects -- this is because they do not represent a 
complete HTML element (one includes the opening form tag, and the other 
includes the closing form tag). Rather than manipulate form.custom.begin, 
it would probably be easier to just insert the relevant HTML into the view 
manually. As for form.custom.end, do you really need to do anything with 
that? It's just the hidden fields that web2py needs plus the  tag. 
Anyway, you can get just the hidden fields with form.hidden_fields().

Anthony

On Tuesday, February 4, 2014 9:51:04 AM UTC-5, Richard wrote:
>
> Hello,
>
> We are trying to manipulate form (a SQLFORM or a .factory) in the 
> controller and then pass the customized form to the view. We want to do 
> this to minimize the code at view level... But we face some quirks with 
> form.custom.begin and .end
>
> May custom form be used from the controller like this??
>
> Thanks
>
> Richard
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: dal retrieve one element from auth_user results in exception when none found

2014-02-04 Thread Massimo Di Pierro
Should have been:

a = db.auth_user(username = 'admin')

On Tuesday, 4 February 2014 08:59:04 UTC-6, Boris Aguilar wrote:
>
> In web2py~2.6 i used to rely on the following to check if an 
> administrative user existed in database:
>
> a = db.auth_user(db.auth_user.username == 'admin') if a was None then the 
> user wasn't in the database
>
> Now in latest version 2.8.2-stable+timestamp.2013.11.28.13.54.07 I'm 
> getting a type error exception:
>
>  'NoneType' object is not iterable
>
> Traceback (most recent call last):
>   File "/home/boris/Work/deploy-web2py-local/gluon/restricted.py", line 217, 
> in restricted
> exec ccode in environment
>   File 
> "/home/boris/Work/deploy-web2py-local/applications/cpfecys/models/db.py" 
> , line 70, in 
> 
> a = db.auth_user(db.auth_user.username == 'admin')
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 8829, in 
> __call__
> limitby=(0,1),for_update=for_update, orderby=orderby, 
> orderby_on_limitby=False).first()
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 10335, in 
> select
> return adapter.select(self.query,fields,attributes)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1831, in 
> select
> return self._select_aux(sql,fields,attributes)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1812, in 
> _select_aux
> return processor(rows,fields,self._colnames,cacheable=cacheable)
>   File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 2173, in 
> parse
> for (i,row) in enumerate(rows):
> TypeError: 'NoneType' object is not iterable
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Problems with the server stalling out. Setting up debuging.

2014-02-04 Thread Michele Comitini
Jason,

I think scheduler can do all you need.
http://web2py.com/books/default/chapter/29/04/the-core#Scheduler
HTH


2014-02-04 Niphlod :

> that's the problem!!!
> Running external programs within the webserver execution model causes the
> thread to be killed if the request takes too much.
> It's process handling 101: NEVER spawn processes from the web application!
>
>
> On Monday, February 3, 2014 10:06:32 PM UTC+1, Encompass solutions wrote:
>
>> Thanks for the pointers!
>> I run two programs... avconv (ffmpeg) and sox both handle file
>> conversions at the moment an upload happens. They bail pretty easily if
>> there was an error.  They are using files I have stored according to my
>> model.
>> BR,
>> Jason Brower
>>
>> On Mon, 2014-02-03 at 19:08 +, Ricardo Pedroso wrote:
>> >
>> > On Sun, Feb 2, 2014 at 6:14 PM, Jason Brower 
>> > wrote:
>> >
>> > It seems that I have an issue I can't resolve.
>> > Every once in a while at seemingly the worst and most random
>> > times, the
>> > service will stall out.  It simply doesn't respond to
>> > anything.
>> > Going into the computer and running htop shows that the
>> > computer is
>> > doing nothing.
>> > I am not running the server with a compiled version of my
>> > code.
>> > I am running:
>> > 2.8.2-stable+timestamp.2013.11.28.13.54.07
>> > (Running on Apache/2.2.22 (Ubuntu), Python 2.7.3)
>> > The application does only basic uploading and loading of a
>> > single item.
>> > Here is an example of the webplayer:
>> > melodigram.com/melodigram/default/gram/b662a1da-8c2b-
>> 11e3-b0dc-1231390a0101
>> >
>> >
>> > I can run F5 reloads on the site for 15 minutes straight, not
>> > have
>> > anyone access the system then then try to load something, be
>> > it the
>> > admin interface or the page I show you here and it site for a
>> > very long
>> > time.  The time it is unresponsive seems random, but that's
>> > because I
>> > haven't discovered how to replicate the problem.
>> > If I restart apache and try, it seems to work every time.
>> >
>> >
>> > This king of issues are hard to know exactly, where the problem is,
>> > without having a clear picture of the application and the
>> > infrastructure.
>> >
>> >
>> > For sure, something is holding apache worker threads for a long time
>> > or indefinitely.
>> >
>> >
>> > when a request for
>> > melodigram.com/melodigram/default/gram/b662a1da-8c2b-
>> 11e3-b0dc-1231390a0101
>> >
>> > is running:
>> >
>> >
>> > Are you using any third party C extension?
>> >
>> >
>> > Are you calling any external program?
>> >
>> >
>> > Where are the files, that are retrieved by the download function,
>> > stored? In the same
>> > box, or been retrieved from a remote location?
>> >
>> >
>> > the first thing I would try is using strace utility against an apache
>> > worker thread to see
>> >
>> > were it is sitting.
>> >
>> >
>> > Ricardo
>> >
>> > --
>> > Resources:
>> > - http://web2py.com
>> > - http://web2py.com/book (Documentation)
>> > - http://github.com/web2py/web2py (Source code)
>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> > ---
>> > You received this message because you are subscribed to a topic in the
>> > Google Groups "web2py-users" group.
>> > To unsubscribe from this topic, visit
>> > https://groups.google.com/d/topic/web2py/BZQF88jug54/unsubscribe.
>> > To unsubscribe from this group and all its topics, send an email to
>> > web2py+un...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: dal retrieve one element from auth_user results in exception when none found

2014-02-04 Thread Anthony
On Tuesday, February 4, 2014 10:30:25 AM UTC-5, Massimo Di Pierro wrote:
>
> Should have been:
>
> a = db.auth_user(username = 'admin')
>

The __call__ method of Table can also take a query as the first argument, 
so the original version should work as well (in fact, it works when I try 
it, on a slightly more recent version than Boris).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: only one session/login per user?

2014-02-04 Thread Anthony
Note, this can be tricky. It is difficult to explicitly log out a user in 
one session based on a login within a different session. This is because 
technically sessions do not expire, so it's not easy to know if another 
login is still active, and it's also difficult to find a given session 
(outside of requests made by that user).

One simple approach might be the following. Add a "current_ip" field to the 
auth_user table. When a user logs in, put the value of request.client in 
that field. Not tested, but something like:

auth.settings.login_onaccept.append(lambda form:
db.auth_user(auth.user_id).update_record(current_ip=request.client))

Then, on every subsequent request, check to make sure request.client equals 
the value in the current_ip field. Something like:

@auth.requires(lambda: db.auth_user(auth.user_id).current_ip == request.
client)

So, a user logs in from machine A, and the machine A ip address is stored 
in current_ip. Then a user logs in from machine B with the same account, so 
the machine B ip address is stored in current_ip. At that point, if machine 
A makes another request, its request.client will no longer match 
current_ip, so access will be denied (until the user on machine A logs out 
and logs back in, which will then prevent machine B from further access).

The downside of this approach is that it requires a database query on every 
request to check the ip address.

An alternative would be upon login, check the auth_event table for logins 
of the same user within some recent time period (e.g., the last 24 hours). 
Then grab the ip addresses of those logins (which are stored in 
db.auth_event.client_ip). Then find all of the sessions whose file names 
(or session ID's if stored in the database) start with any of those ip 
addresses (excluding the ip address of the current request, of course). 
Then check each of those sessions to see if they include an "auth" object 
for the current user, and if so, delete that "auth" object from the session 
(or simply delete the session entirely). This is a bit more complicated and 
CPU/IO intensive, but it only happens upon login, not on every request. 
Also, it won't work with cookie based sessions.

Anthony

On Tuesday, February 4, 2014 1:41:52 AM UTC-5, DeanK wrote:
>
> I've been searching around trying to figure out how to do this without 
> success.  I need to enforce only a single login per user.  Out of the box 
> you can login using the same credentials from different computers, but I 
> need logging in on a different computer to terminate the session of the 
> first log in.  Is this possible?  I found some posts that hinted at using 
> session.connect, but then i couldn't find "check_client" in the ebook...and 
> it didn't seem to work when i tested it.
>
>
> ## Limit single user sessions
> session.connect(request,response,check_client=True) 
>
> Any tips would be appreciated.  Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2014-02-04 Thread Niphlod
how are you "custom building" the binary ?

The "official" scripts deals with py2exe's incorrect packaging system with 
these lines

https://github.com/web2py/web2py/blob/master/extras/build_web2py/setup_exe.py#L100

BTW: we're moving towards bbfreeze packed binaries, and they seem to work 
well with bbreeze 0.13

On Tuesday, February 4, 2014 12:50:54 PM UTC+1, step wrote:
>
> In upgrading from 2.6.4 to 2.8.2 my custom-built web2py_no_console.exe 
> failed starting the rocket server with a 'can't import module http' python 
> error. It's something seemingly unrelated to the other posters' issues, but 
> I'm sharing how I was able to fix it, maybe it will help someone.
> Essentially the fix consists in editing web2py_exe.py and commenting out 
> the new code block that slims down library.zip. That was it, in my case. I 
> rebuilt my web2py_no_console.exe with the fatter library.zip and the import 
> error went away. The new code was added in 2.8.2, apparently it's harmless 
> but in my case it makes the difference between a working 
> web2py_no_console.exe and a broken one. I wonder, maybe there is a reason 
> why py2exe builds a larger library.zip file so seemingly full of 
> duplicates. For the record, I wish the size trimming had worked - in my 
> case it had shrunk library.zip from 16MB down to about 6MB. 
>
> On Saturday, January 18, 2014 7:08:58 PM UTC+1, Niphlod wrote:
>>
>> we're trying to come up with something here 
>> http://code.google.com/p/web2py/issues/detail?id=1809
>>
>> if you have any inputs please share ^_^
>>
>> On Saturday, January 18, 2014 1:30:33 AM UTC+1, Ray (a.k.a. Iceberg) 
>> wrote:
>>>
>>>
>>>
>>> On Sunday, December 15, 2013 10:00:19 AM UTC-7, Rob Paire wrote:

 Hello all,
  I am having same problem running on Windows server 2003 32bit. When I 
 launch web2py.exe the following dialog error appears: 

 *Title: Error Entry Point Not Found*

 *Description: The procedure entry point wcscpy_s could not be located 
 in the dynamic link library msvcrt.dll*

 Clicking OK returns control to the web2py executable which fails with 
 the following console message:

 C:\web2py>web2py
 Traceback (most recent call last):
   File "", line 6, in 
   File "__main__.py", line 128, in 
   File "__main__web2py__.py", line 18, in 
   File "/home/mdipierro/make_web2py/web2py/gluon/__init__.py", line 15, 
 in >>> le>
   File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 19, 
 in >>> e>
   File "/home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py", line 10, 
 in >>> >
   File "SimpleXMLRPCServer.py", line 102, in 
   File "xmlrpclib.py", line 144, in 
   File "httplib.py", line 79, in 
   File "mimetools.py", line 6, in 
   File "tempfile.py", line 35, in 
   File "random.py", line 879, in 
   File "random.py", line 97, in __init__
   File "random.py", line 111, in seed
 WindowsError: [Error -2146893795] Provider DLL failed to initialize 
 correctly

 I reverted back to 2.7.4 for the time being.

  
>>> Same problem here.  I guess that *msvcrt.dll* thing is because the 
>>> web2py282 windows builder is running on a different Windows platform than 
>>> before.
>>> Now I have to roll back.
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Grid in component edit twice issue

2014-02-04 Thread Niphlod
are you using exactly the app you packed ?

On Tuesday, February 4, 2014 2:53:41 AM UTC+1, Jim Karsten wrote:
>
> Originally the *Edit* button has this code: 
>
> https://groups.google.com/testy/default/component.load/edit/person/1"; 
> data-w2p_target="c932772971645" data-w2p_method="GET" 
> data-w2p_disable_with="default"> 
>  
> Edit 
>  
>
> I then edit and submit and the Edit button then has this code: 
>
> https://groups.google.com/testy/default/component.load/edit/person/1"; 
> data-w2p_disable_with="default"> 
>  
> Edit
>  
>
> The *data-w2p_target* and *data-w2p_method* attributes appear to be 
> dropped.
>
> I use Firebug. I don't see any js errors in the Console.
>   
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] dal retrieve one element from auth_user results in exception when none found

2014-02-04 Thread Boris Aguilar
In web2py~2.6 i used to rely on the following to check if an administrative 
user existed in database:

a = db.auth_user(db.auth_user.username == 'admin') if a was None then the 
user wasn't in the database

Now in latest version 2.8.2-stable+timestamp.2013.11.28.13.54.07 I'm 
getting a type error exception:

 'NoneType' object is not iterable

Traceback (most recent call last):
  File "/home/boris/Work/deploy-web2py-local/gluon/restricted.py", line 217, in 
restricted
exec ccode in environment
  File "/home/boris/Work/deploy-web2py-local/applications/cpfecys/models/db.py" 
, line 70, in 

a = db.auth_user(db.auth_user.username == 'admin')
  File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 8829, in 
__call__
limitby=(0,1),for_update=for_update, orderby=orderby, 
orderby_on_limitby=False).first()
  File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 10335, in 
select
return adapter.select(self.query,fields,attributes)
  File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1831, in select
return self._select_aux(sql,fields,attributes)
  File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 1812, in 
_select_aux
return processor(rows,fields,self._colnames,cacheable=cacheable)
  File "/home/boris/Work/deploy-web2py-local/gluon/dal.py", line 2173, in parse
for (i,row) in enumerate(rows):
TypeError: 'NoneType' object is not iterable

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Problems with the server stalling out. Setting up debuging.

2014-02-04 Thread Niphlod
that's the problem!!! 
Running external programs within the webserver execution model causes the 
thread to be killed if the request takes too much.
It's process handling 101: NEVER spawn processes from the web application!

On Monday, February 3, 2014 10:06:32 PM UTC+1, Encompass solutions wrote:
>
> Thanks for the pointers! 
> I run two programs... avconv (ffmpeg) and sox both handle file 
> conversions at the moment an upload happens. They bail pretty easily if 
> there was an error.  They are using files I have stored according to my 
> model. 
> BR, 
> Jason Brower 
>
> On Mon, 2014-02-03 at 19:08 +, Ricardo Pedroso wrote: 
> > 
> > On Sun, Feb 2, 2014 at 6:14 PM, Jason Brower 
> > > 
>
> > wrote: 
> > 
> > It seems that I have an issue I can't resolve. 
> > Every once in a while at seemingly the worst and most random 
> > times, the 
> > service will stall out.  It simply doesn't respond to 
> > anything. 
> > Going into the computer and running htop shows that the 
> > computer is 
> > doing nothing. 
> > I am not running the server with a compiled version of my 
> > code. 
> > I am running: 
> > 2.8.2-stable+timestamp.2013.11.28.13.54.07 
> > (Running on Apache/2.2.22 (Ubuntu), Python 2.7.3) 
> > The application does only basic uploading and loading of a 
> > single item. 
> > Here is an example of the webplayer: 
> > 
> melodigram.com/melodigram/default/gram/b662a1da-8c2b-11e3-b0dc-1231390a0101 
> > 
> >   
> > I can run F5 reloads on the site for 15 minutes straight, not 
> > have 
> > anyone access the system then then try to load something, be 
> > it the 
> > admin interface or the page I show you here and it site for a 
> > very long 
> > time.  The time it is unresponsive seems random, but that's 
> > because I 
> > haven't discovered how to replicate the problem. 
> > If I restart apache and try, it seems to work every time. 
> > 
> > 
> > This king of issues are hard to know exactly, where the problem is, 
> > without having a clear picture of the application and the 
> > infrastructure. 
> > 
> > 
> > For sure, something is holding apache worker threads for a long time 
> > or indefinitely. 
> > 
> > 
> > when a request for 
> > 
> melodigram.com/melodigram/default/gram/b662a1da-8c2b-11e3-b0dc-1231390a0101 
> > 
> > is running: 
> > 
> > 
> > Are you using any third party C extension? 
> > 
> > 
> > Are you calling any external program? 
> > 
> > 
> > Where are the files, that are retrieved by the download function, 
> > stored? In the same 
> > box, or been retrieved from a remote location? 
> > 
> > 
> > the first thing I would try is using strace utility against an apache 
> > worker thread to see 
> > 
> > were it is sitting. 
> > 
> > 
> > Ricardo 
> > 
> > -- 
> > Resources: 
> > - http://web2py.com 
> > - http://web2py.com/book (Documentation) 
> > - http://github.com/web2py/web2py (Source code) 
> > - https://code.google.com/p/web2py/issues/list (Report Issues) 
> > --- 
> > You received this message because you are subscribed to a topic in the 
> > Google Groups "web2py-users" group. 
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/web2py/BZQF88jug54/unsubscribe. 
> > To unsubscribe from this group and all its topics, send an email to 
> > web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] can custom.form be used from the controller and pass to the view??

2014-02-04 Thread Richard
Hello,

We are trying to manipulate form (a SQLFORM or a .factory) in the 
controller and then pass the customized form to the view. We want to do 
this to minimize the code at view level... But we face some quirks with 
form.custom.begin and .end

May custom form be used from the controller like this??

Thanks

Richard

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Two grids, different behaviour.

2014-02-04 Thread Anthony
If there are args in your URL not generated by the grid, you have to tell 
the grid about it so it knows to include those args in the URLs it 
generates (otherwise it just includes its own args). So, if you are using 
the first URL arg for something, then do:

SQLFORM.grid(..., args=request.args[:1])

Anthony

On Tuesday, February 4, 2014 7:01:04 AM UTC-5, Johann Spies wrote:
>
> I have the following models:
>
> db.define_table('survey',
> Field('name', label = 'Name of the new survey',
>   requires = IS_NOT_IN_DB(db, 'survey.name'),
>   unique = True),
> Field('owner', db.auth_user, default = auth.user_id,
>readable = True, writable = False),
> Field('startdate', 'date'),
> Field('enddate', 'date'),
> format='%(name)s')
>
> db.define_table('questions',
> Field('survey_id', db.survey),
> Field('question_number', requires = IS_NOT_EMPTY()),
> Field('question', 'text', requires = IS_NOT_EMPTY(),
>   represent = lambda value,row: XML(value),
>   widget = advanced_editor),
> Field('answer_type', 'integer',
>   requires=IS_IN_SET(ANSWER_TYPE)))
>
> db.define_table('options',
> Field('question_id', db.questions),
> Field('option_number'),
> Field('option'))
>
>
> When using the following grid, I can use the standard View/Edit/Delete 
> buttons and it works as expected:
>
>  survey_id = request.get_vars.survey_id
> query = db.questions.survey_id==survey_id
> fields = [db.questions.question_number,
>   db.questions.question,db.questions.answer_type,
>   db.questions.id]
> questions = SQLFORM.grid(query,
>  editable = True,
>  deletable = True,
>  create = True,
>  searchable = False,
>  maxtextlength = 100,
>  orderby=db.questions.question_number
>  , user_signature = True)
>
> Example of url: 
> http://localhost:8000/survey_app/default/edit_survey/edit/questions/2745?survey_id=220&_signature=1e41f2ab5820fe9422d7f1a552f61136cefb26a9
>
>
> But with this one, using anyone of those buttons ends with a 404 Not found 
> message:
>
> qid = request.args(0,cast=int)
> query = db.options.question_id == qid
> fields = [db.options.id, db.options.option_number, db.options.option]
> form = SQLFORM.grid(query,
> editable = True,
> deletable = True,
> searchable = False,
> maxtextlength = 100,
> fields = fields,
> user_signature = True,
> create = False)
> 
> Example of url: 
> http://localhost:8000/survey_app/default/edit_options/edit/options/4694?_signature=ec61c90b8595bb73539a0e364f8f4e422f641dd7
>
> Question: Why can the second grid not find the records when I use the 
> buttons?
> Both the id's in the url's (2745 and 4694) are valid.
>
> Regards
> Johann
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login_next and next var

2014-02-04 Thread Massimo Di Pierro
Notice extra ' before 'URL

On Tuesday, 4 February 2014 02:04:52 UTC-6, Annet wrote:
>
> Massimo,
>
> Thanks for your reply.
>
> I tried:
>
>  onclick="javascript:openwindow('{{=URL('cms', 'default', 'user', 
> args=['login', request.args(0)], vars=dict(_next='URL('cms', 'group', 
> 'connect', args=request.args())'))}}', 'connect')" role="button">Login
>
> But that gives me the following error:
>
> Traceback (most recent call last):
>   File "/Users/annet/web2py/gluon/restricted.py", line 216, in restricted
> ccode = compile2(code, layer)
>   File "/Users/annet/web2py/gluon/restricted.py", line 199, in compile2
> return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
>   File "/Users/annet/web2py/applications/init/views/default/test.html", line 
> 91
> response.write(URL('cms', 'default', 'user', args=['login', 
> request.args(0)], vars=dict(_next='URL('cms', 'group', 'connect', 
> args=request.args())')))
>   
>^
> SyntaxError: invalid syntax
>
>
>
> Kind regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: only one session/login per user?

2014-02-04 Thread Anthony
I think check_client simply checks to make sure a given session cookie has 
come from the same client (i.e., to prevent cookie stealing), and it only 
works for file based sessions. Doesn't look like it would prevent two 
separate logins (which would simply have different sessions and therefore 
different session cookies).

Anthony

On Tuesday, February 4, 2014 1:41:52 AM UTC-5, DeanK wrote:
>
> I've been searching around trying to figure out how to do this without 
> success.  I need to enforce only a single login per user.  Out of the box 
> you can login using the same credentials from different computers, but I 
> need logging in on a different computer to terminate the session of the 
> first log in.  Is this possible?  I found some posts that hinted at using 
> session.connect, but then i couldn't find "check_client" in the ebook...and 
> it didn't seem to work when i tested it.
>
>
> ## Limit single user sessions
> session.connect(request,response,check_client=True) 
>
> Any tips would be appreciated.  Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Two grids, different behaviour.

2014-02-04 Thread Johann Spies
I have the following models:

db.define_table('survey',
Field('name', label = 'Name of the new survey',
  requires = IS_NOT_IN_DB(db, 'survey.name'),
  unique = True),
Field('owner', db.auth_user, default = auth.user_id,
   readable = True, writable = False),
Field('startdate', 'date'),
Field('enddate', 'date'),
format='%(name)s')

db.define_table('questions',
Field('survey_id', db.survey),
Field('question_number', requires = IS_NOT_EMPTY()),
Field('question', 'text', requires = IS_NOT_EMPTY(),
  represent = lambda value,row: XML(value),
  widget = advanced_editor),
Field('answer_type', 'integer',
  requires=IS_IN_SET(ANSWER_TYPE)))

db.define_table('options',
Field('question_id', db.questions),
Field('option_number'),
Field('option'))


When using the following grid, I can use the standard View/Edit/Delete 
buttons and it works as expected:

 survey_id = request.get_vars.survey_id
query = db.questions.survey_id==survey_id
fields = [db.questions.question_number,
  db.questions.question,db.questions.answer_type,
  db.questions.id]
questions = SQLFORM.grid(query,
 editable = True,
 deletable = True,
 create = True,
 searchable = False,
 maxtextlength = 100,
 orderby=db.questions.question_number
 , user_signature = True)

Example of url: 
http://localhost:8000/survey_app/default/edit_survey/edit/questions/2745?survey_id=220&_signature=1e41f2ab5820fe9422d7f1a552f61136cefb26a9


But with this one, using anyone of those buttons ends with a 404 Not found 
message:

qid = request.args(0,cast=int)
query = db.options.question_id == qid
fields = [db.options.id, db.options.option_number, db.options.option]
form = SQLFORM.grid(query,
editable = True,
deletable = True,
searchable = False,
maxtextlength = 100,
fields = fields,
user_signature = True,
create = False)

Example of url: 
http://localhost:8000/survey_app/default/edit_options/edit/options/4694?_signature=ec61c90b8595bb73539a0e364f8f4e422f641dd7

Question: Why can the second grid not find the records when I use the 
buttons?
Both the id's in the url's (2745 and 4694) are valid.

Regards
Johann


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Can not run web2py_no_console.exe. Version 2.8.2 on win 7 x 64

2014-02-04 Thread step
In upgrading from 2.6.4 to 2.8.2 my custom-built web2py_no_console.exe 
failed starting the rocket server with a 'can't import module http' python 
error. It's something seemingly unrelated to the other posters' issues, but 
I'm sharing how I was able to fix it, maybe it will help someone.
Essentially the fix consists in editing web2py_exe.py and commenting out 
the new code block that slims down library.zip. That was it, in my case. I 
rebuilt my web2py_no_console.exe with the fatter library.zip and the import 
error went away. The new code was added in 2.8.2, apparently it's harmless 
but in my case it makes the difference between a working 
web2py_no_console.exe and a broken one. I wonder, maybe there is a reason 
why py2exe builds a larger library.zip file seemengly full of duplicates. 
For the record, I wish the size trimming had worked - in my case it had 
shrunk library.zip from 16MB down to about 6MB. 

On Saturday, January 18, 2014 7:08:58 PM UTC+1, Niphlod wrote:
>
> we're trying to come up with something here 
> http://code.google.com/p/web2py/issues/detail?id=1809
>
> if you have any inputs please share ^_^
>
> On Saturday, January 18, 2014 1:30:33 AM UTC+1, Ray (a.k.a. Iceberg) wrote:
>>
>>
>>
>> On Sunday, December 15, 2013 10:00:19 AM UTC-7, Rob Paire wrote:
>>>
>>> Hello all,
>>>  I am having same problem running on Windows server 2003 32bit. When I 
>>> launch web2py.exe the following dialog error appears: 
>>>
>>> *Title: Error Entry Point Not Found*
>>>
>>> *Description: The procedure entry point wcscpy_s could not be located in 
>>> the dynamic link library msvcrt.dll*
>>>
>>> Clicking OK returns control to the web2py executable which fails with 
>>> the following console message:
>>>
>>> C:\web2py>web2py
>>> Traceback (most recent call last):
>>>   File "", line 6, in 
>>>   File "__main__.py", line 128, in 
>>>   File "__main__web2py__.py", line 18, in 
>>>   File "/home/mdipierro/make_web2py/web2py/gluon/__init__.py", line 15, 
>>> in >> le>
>>>   File "/home/mdipierro/make_web2py/web2py/gluon/globals.py", line 19, 
>>> in >> e>
>>>   File "/home/mdipierro/make_web2py/web2py/gluon/xmlrpc.py", line 10, in 
>>> >> >
>>>   File "SimpleXMLRPCServer.py", line 102, in 
>>>   File "xmlrpclib.py", line 144, in 
>>>   File "httplib.py", line 79, in 
>>>   File "mimetools.py", line 6, in 
>>>   File "tempfile.py", line 35, in 
>>>   File "random.py", line 879, in 
>>>   File "random.py", line 97, in __init__
>>>   File "random.py", line 111, in seed
>>> WindowsError: [Error -2146893795] Provider DLL failed to initialize 
>>> correctly
>>>
>>> I reverted back to 2.7.4 for the time being.
>>>
>>>  
>> Same problem here.  I guess that *msvcrt.dll* thing is because the 
>> web2py282 windows builder is running on a different Windows platform than 
>> before.
>> Now I have to roll back.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Satchless and web2py for e-commerce?

2014-02-04 Thread Michele Comitini
This project seems interesting to build e-shops with.

http://satchless.com/

Has anyone tried it coupled with web2py?

mic

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: login_next and next var

2014-02-04 Thread Annet
Massimo,

Thanks for your reply.

I tried:

Login

But that gives me the following error:

Traceback (most recent call last):
  File "/Users/annet/web2py/gluon/restricted.py", line 216, in restricted
ccode = compile2(code, layer)
  File "/Users/annet/web2py/gluon/restricted.py", line 199, in compile2
return compile(code.rstrip().replace('\r\n', '\n') + '\n', layer, 'exec')
  File "/Users/annet/web2py/applications/init/views/default/test.html", line 91
response.write(URL('cms', 'default', 'user', args=['login', 
request.args(0)], vars=dict(_next='URL('cms', 'group', 'connect', 
args=request.args())')))

 ^
SyntaxError: invalid syntax



Kind regards,

Annet

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.