正在显示
2 个修改的文件
包含
12 行增加
和
0 行删除
| @@ -45,6 +45,15 @@ class WorkPlace(): | @@ -45,6 +45,15 @@ class WorkPlace(): | ||
| 45 | data['date[current]'] = 'on' | 45 | data['date[current]'] = 'on' |
| 46 | return data | 46 | return data |
| 47 | 47 | ||
| 48 | + @classmethod | ||
| 49 | + def from_dict(cls,data:dict): | ||
| 50 | + self = cls() | ||
| 51 | + for k,v in data.items(): | ||
| 52 | + if hasattr(self,k): | ||
| 53 | + setattr(self,k,v) | ||
| 54 | + return self | ||
| 55 | + | ||
| 56 | + | ||
| 48 | 57 | ||
| 49 | @attrs(cmp=False) | 58 | @attrs(cmp=False) |
| 50 | class College(): | 59 | class College(): |
| @@ -156,7 +156,10 @@ class RequestSource(): | @@ -156,7 +156,10 @@ class RequestSource(): | ||
| 156 | @classmethod | 156 | @classmethod |
| 157 | def get(cls, channel): | 157 | def get(cls, channel): |
| 158 | if isinstance(channel, str): | 158 | if isinstance(channel, str): |
| 159 | + try: | ||
| 159 | channel = int(channel) | 160 | channel = int(channel) |
| 161 | + except: | ||
| 162 | + pass | ||
| 160 | return cls.const.get(channel, channel) | 163 | return cls.const.get(channel, channel) |
| 161 | 164 | ||
| 162 | 165 |
-
请 注册 或 登录 后发表评论