cherrypy'tools.sessions.secure'似乎正在破坏会话(cherrypy 'tools.sessions.secure' seems to be breaking sessions)
我正在localhost上开发一个cherrypy应用程序,并写了这个来弄清楚会话正在发生什么。
import cherrypy class WhyNotSessions(object): @cherrypy.expose def index(self): if 'count' not in cherrypy.session: cherrypy.session['count'] = 0 cherrypy.session['count'] += 1 return "Session count is %s" % cherrypy.session.get('count') if __name__ == '__main__': conf = { '/': { 'tools.sessions.on': True, 'tools.sessions.secure': True } } cherrypy.quickstart(WhyNotSessions(), '/', conf)
这可以按预期工作,并且在重新加载时递增
count
- 只要我注释掉'tools.sessions.secure': True
从conf
。 我想更好地理解这里发生的事情,因为我打算在生产中使用安全会话。I'm developing a cherrypy application on localhost and wrote this to figure out what's going on with sessions.
import cherrypy class WhyNotSessions(object): @cherrypy.expose def index(self): if 'count' not in cherrypy.session: cherrypy.session['count'] = 0 cherrypy.session['count'] += 1 return "Session count is %s" % cherrypy.session.get('count') if __name__ == '__main__': conf = { '/': { 'tools.sessions.on': True, 'tools.sessions.secure': True } } cherrypy.quickstart(WhyNotSessions(), '/', conf)
This works as expected, with
count
incrementing on reload - as long as I comment out'tools.sessions.secure': True
fromconf
. I'd like to understand better what's happening here because I intend to use secure sessions in production.
原文:https://stackoverflow.com/questions/40360779
最满意答案
试试这个,让我知道,以防你遇到任何困难。
select a.name,c.channel_name from user a left join subscriptions b on a.user_id = b.user_id left join channel c on b.channel_id = c.channel_id;
或(以评论中提到的格式)
select u.name,c.channel_name from user u left join subscriptions s on u.user_id = s.user_id left join channel c on s.channel_id = c.channel_id;
Try this out and let me know in case you face any difficulty.
select a.name,c.channel_name from user a left join subscriptions b on a.user_id = b.user_id left join channel c on b.channel_id = c.channel_id;
or (in the format u asked in comments)
select u.name,c.channel_name from user u left join subscriptions s on u.user_id = s.user_id left join channel c on s.channel_id = c.channel_id;
相关问答
更多-
您可以使用窗口函数来查找每个sensorname / datetimeid组合的波长数量: WITH Data AS ( SELECT W.DateTimeID, S.SensorName, S.SensorType, W.Channel, W.PeakNr, W.Wavelength, [Wcount] = COUNT(*) OVER(PARTITION B ...
-
select Location_ID from CategoryLocations where Category_ID in (2,3) group by Location_ID having COUNT(distinct Category_ID) = 2 -- this 2 is the number of items in the IN list above select Location_ID from CategoryLocations where Category_ID ...
-
如果您可以更具体,那就更容易了。 无论如何,我认为你的问题是你在第一次加入后不使用select 。 格式应该是这样的: var output = from class1 in context.Table1 join class2 in context.Table2 on class1.ID equals class2.DeviceID select new { Class1 = class1, Class2 = class2 } into firstJoin join class3 in cont ...
-
虽然颜色不是唯一标识符,但如果您计划对其执行连接,则会将其视为此类。 SELECT * FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.COLOR = t2.COLOR ORDER BY COLOR DESC; 这将输出三列,其中包含12个“红色行”和15个“蓝色行”。 While color is not a unique identifier, if you plan to perform a join on it, it will be treated as suc ...
-
这将提供场地名称和场地开放时的所有日子: SELECT ven.name, array_agg(oh.day) FROM venue ven NATURAL JOIN opening_hour oh GROUP BY ven.name; This will give the venue name and an array of all days when the venue is open: SELECT ven.name, array_agg(oh.day) FROM venue ven ...
-
如果您当前的查询(使用视图)为您提供了所需的内容,那么我相信此查询将在单个查询中为您提供相同的内容: SELECT sum(inv_item.qty_invoiced*inv_item.price) FROM inv_item JOIN inv_hdr ON dbo.inv_item.inv_num = dbo.inv_hdr.inv_num JOIN coitem ON (inv_hdr.co_num=coitem.co_num AND inv_item.co_line=coitem. ...
-
SQL查询基于单一关系耗尽多对多关系?(SQL query exhausting many-to-many relationship based on single relationship?)[2022-10-01]
使用having子句; SELECT b.rowid, b.name, GROUP_CONCAT(c.name, ', ') as citylist FROM businesses b JOIN associations a ON b.rowid = a.business_id JOIN cities c ON c.rowid = a.city_id GROUP BY b.rowid, b.name HAVING SUM(CASE WHEN c.name ... -
sql:多对多关系加入(sql: many to many relationship join)[2023-06-25]
试试这个,让我知道,以防你遇到任何困难。 select a.name,c.channel_name from user a left join subscriptions b on a.user_id = b.user_id left join channel c on b.channel_id = c.channel_id; 或(以评论中提到的格式) select u.name,c.channel_name from user u left join subscriptions s on u.use ... -
在SQL Server中使用JOIN一对多关系更新SELECT(UPDATE SELECT with JOIN one-to-many relationship in SQL server)[2022-08-17]
在谈论RDBMS中的表时,没有“第一行”或“最后一行”这样的定义。 如果您尚未指定任何订单,则数据库引擎可以将任何记录作为第一个记录使用。 当然有例外,例如聚集索引的存在,整理等。 如果您没有指定任何订单,则不能简单地假设第一条记录是什么。 我建议您修改查询以使用更新中所需值的预定义顺序。 例如,如果要更新为以字母数字顺序排在第一位的值,请使用以下查询: UPDATE A SET Col2 = B.Col2 FROM A INNER JOIN ( SELECT Col1, Col2, ROW_NUMBER ... -
尝试选择字符串而不是匿名对象,如下所示: var jsonData = from w in bookData join b in barcodes on w.Id equals b.BookId select new { w.AccessionNo, AuthorName=str ...