V2EX xpke04
 xpke04 最近的时间轴更新
xpke04

xpke04

V2EX 第 160255 号会员,加入于 2016-02-24 10:27:59 +08:00
xpke04 最近回复了
2018-04-09 16:30:06 +08:00
回复了 xpke04 创建的主题 Python 请教针对不同 Model 对象的相似处理的精简方法?
v2ex 贴代码太不方便了,我把问题移至 segmentfault 了, https://segmentfault.com/q/1010000014261968
2018-04-09 16:21:22 +08:00
回复了 xpke04 创建的主题 Python 请教针对不同 Model 对象的相似处理的精简方法?
补充一下描述,

``` python
def change_docorder():
reqdata = request.json
op = reqdata["op"]
docid = reqdata["docid"]

# 如果是上移文档顺序
if op == "up":
another = DocItem.query.filter(and_(DocItem.category_id == docitem.category_id,
DocItem.order < docitem.order)).order_by(DocItem.order.desc()).first()
if another is None:
return error_response(u"无法继续移动该文档顺序!")
tmp = another.order
another.order = docitem.order
docitem.order = tmp
another.save()
docitem.save()
elif op == "down":
another = DocItem.query.filter(and_(DocItem.category_id == docitem.category_id,
DocItem.order>docitem.order)).order_by(DocItem.order.asc()).first()
if another is None:
return error_response(u"无法继续移动该文档顺序!")
tmp = another.order
another.order = docitem.order
docitem.order = tmp
another.save()
docitem.save()
else:
return make_response(u"非法的操作!")
return make_response(json.dumps({
"status": "success",
"msg": u"修改文档顺序成功!"
}))
```

这是针对 DocItem 这个 model 进行的调整顺序操作,还有其他的几个 model 对象需要进行相同的操作,如何如果都分别写一个函数来实现功能,最终代码只有类名 `DocItem` 是不一样的。

以上是对问题的补充描述。
2017-10-27 15:01:13 +8:00
回复了 xpke04 创建的主题 问与答 docker 中多个容器访问 expose 端口的诡异问题
补充,docker 网络使用的是默认的 bridge 模式,另外,在容器中是能够访问主机上绑定的其他端口的服务的,但是不能访问容器 expose 出来的端口上的服务。
2016-02-24 13:40:15 +08:00
回复了 xpke04 创建的主题 酷工作 网易游戏的 BI 岗位主要工作内容和能力要求
给自己挽尊。
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     4118 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 19ms UTC 01:00 PVG 09:00 LAX 18:00 JFK 21:00
Do have faith in what you're doing.
ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86