https://bugzilla.wikimedia.org/show_bug.cgi?id=55195
--- Comment #2 from Kunal Mehta (Legoktm) legoktm.wikipedia@gmail.com --- an idea for getFilename (could anybody test it whether it works)
if not title: #find the max length for a mw title maxBytes = 240 - len(project.encode('utf-8')) \ - len(username.encode('utf-8')) description = photoInfo.find('photo').find('description').text if description: descBytes = len(description.encode('utf-8')) if descBytes > maxBytes: # maybe we cut more than needed, anyway we do it items = max(0, len(description) - maxBytes + descBytes) description = description[:items] title = cleanUpTitle(description) else: title = u'' # Should probably have the id of the photo as last resort.