| 114 | |
| 115 | #balance-then-quota |
| 116 | elif entry.LimitBy and (entry.LimitBy.lower() == "balance-then-quota") : |
| 117 | if balance <= 0 : |
| 118 | if (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : |
| 119 | datelimit = "DENY" |
| 120 | elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : |
| 121 | datelimit = "DENY" |
| 122 | elif quota.DateLimit is not None : |
| 123 | now = DateTime.now() |
| 124 | datelimit = DateTime.ISO.ParseDateTime(quota.DateLimit) |
| 125 | if now >= datelimit : |
| 126 | datelimit = "QUOTA_DENY" |
| 127 | else : |
| 128 | datelimit = "" |
| 129 | reached = ( ((datelimit == "DENY" ) and "+B") or "-Q") |
| 130 | datelimit = ( ((datelimit == "QUOTA_DENY") and "DENY") or datelimit) |
| 131 | elif balance <= self.tool.config.getPoorMan() : |
| 132 | if (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : |
| 133 | datelimit = "WARNING" |
| 134 | elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : |
| 135 | datelimit = "WARNING" |
| 136 | elif quota.DateLimit is not None : |
| 137 | now = DateTime.now() |
| 138 | datelimit = DateTime.ISO.ParseDateTime(quota.DateLimit) |
| 139 | if now >= datelimit : |
| 140 | datelimit = "QUOTA_DENY" |
| 141 | else : |
| 142 | datelimit = "" |
| 143 | reached = ( ((datelimit == "WARNING" ) and "?B") or "+Q") |
| 144 | datelimit = ( ((datelimit == "QUOTA_DENY") and "WARNING") or datelimit) |
| 145 | else : |
| 146 | datelimit = "" |
| 147 | reached = "-B" |
| 148 | |
| 149 | #Quota-then-balance |
| 150 | elif entry.LimitBy and (entry.LimitBy.lower() == "quota-then-balance") : |
| 151 | if (quota.HardLimit is not None) and (pagecounter >= quota.HardLimit) : |
| 152 | datelimit = "DENY" |
| 153 | elif (quota.HardLimit is None) and (quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) : |
| 154 | datelimit = "DENY" |
| 155 | elif quota.DateLimit is not None : |
| 156 | now = DateTime.now() |
| 157 | datelimit = DateTime.ISO.ParseDateTime(quota.DateLimit) |
| 158 | if now >= datelimit : |
| 159 | datelimit = "DENY" |
| 160 | else : |
| 161 | datelimit = "" |
| 162 | |
| 163 | reached = (((quota.SoftLimit is not None) and (pagecounter >= quota.SoftLimit) and "+") or "-") + "Q" |
| 164 | |
| 165 | if (datelimit == "DENY") and (reached == "-Q") and (balance > self.tool.config.getPoorMan()) : |
| 166 | datelimit = "" |
| 167 | reached = "-B" |
| 168 | else : |
| 169 | reached = (((datelimit == "DENY") and (self.tool.config.getPoorMan() < balance ) and "-B") or reached) |
| 170 | if (datelimit == "DENY") and (self.tool.config.getPoorMan() < balance) : |
| 171 | datelimit = "" |
| 172 | reached = (((datelimit == "DENY") and (0.0 < balance <= self.tool.config.getPoorMan()) and "?B") or reached) |
| 173 | datelimit = (((datelimit == "DENY") and (0.0 < balance <= self.tool.config.getPoorMan()) and "WARNING") or datelimit) |
| 174 | |
| 175 | #Quota |