(name, character_limit = 10)
| 240 | |
| 241 | |
| 242 | def safe_name(name, character_limit = 10): |
| 243 | # TODO review using unicdoe normalize ie |
| 244 | # https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8 |
| 245 | |
| 246 | name = name[:character_limit] |
| 247 | |
| 248 | name = name.lower() # Email safe no upper case |
| 249 | # Want to preserve user capitilized things though |
| 250 | |
| 251 | safe_name = "" |
| 252 | |
| 253 | for char in name: |
| 254 | if char in valid_chars: |
| 255 | safe_name += char |
| 256 | |
| 257 | return safe_name |
| 258 | |
| 259 | |
| 260 | # see auth_api_new copied from there |